mirror of
https://github.com/systemd/systemd.git
synced 2024-11-05 15:21:37 +03:00
login: fix potential null pointer dereference
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.
This commit is contained in:
parent
eb59b60941
commit
b9460fdc8b
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user