chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
124457a
)
login: fix potential null pointer dereference
author
Ronny Chevalier
<chevalier.ronny@gmail.com>
Fri, 12 Jun 2015 09:37:11 +0000
(11:37 +0200)
committer
Sven Eden
<yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:01:51 +0000
(10:01 +0100)
Fix CID
1304686
: Dereference after null check (FORWARD_NULL)
However, this commit does not fix any bug in logind. It helps to keep
the elect_display_compare() function generic.
src/login/logind-user.c
patch
|
blob
|
history
diff --git
a/src/login/logind-user.c
b/src/login/logind-user.c
index c0b473930db0bf71e69861de2e60ec5b552c2a39..a9cf529e12a049899e46a10f32f99a584b3bad4a 100644
(file)
--- a/
src/login/logind-user.c
+++ b/
src/login/logind-user.c
@@
-763,6
+763,9
@@
static int elect_display_compare(Session *s1, Session *s2) {
* is preferred.
*
* s1 or s2 may be NULL. */
+ if (!s1 && !s2)
+ return 0;
+
if ((s1 == NULL) != (s2 == NULL))
return (s1 == NULL) - (s2 == NULL);