mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
setup_utmp: add error check in case getpwuid fails.
Spotted by Coverity: if there is no password file entry associated with our numeric uid, we'll press on anyway and dereference NULL.
This commit is contained in:
parent
4ea56076a8
commit
caf4802b0a
@ -206,6 +206,8 @@ static void setup_utmp(char *ttyname, char *location)
|
||||
struct timeval tv;
|
||||
|
||||
pw = getpwuid(getuid());
|
||||
if (!pw)
|
||||
return; /* can't stamp utmp if we don't have a username */
|
||||
memset(&utmp_entry, 0, sizeof(utmp_entry));
|
||||
utmp_entry.ut_type = USER_PROCESS;
|
||||
utmp_entry.ut_pid = getpid();
|
||||
|
Loading…
Reference in New Issue
Block a user