Explorar o código

Do not assume NULL termination on the ut_id field. Thanks
to mac12@po.cwru.edu for spotting this one.

Eric Andersen %!s(int64=23) %!d(string=hai) anos
pai
achega
30b32340bd
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      libc/misc/utmp/utent.c

+ 1 - 1
libc/misc/utmp/utent.c

@@ -138,7 +138,7 @@ struct utmp *getutid (const struct utmp *utmp_entry)
 		 utmp_entry->ut_type == DEAD_PROCESS ||
 		 utmp_entry->ut_type == LOGIN_PROCESS ||
 		 utmp_entry->ut_type == USER_PROCESS) &&
-		!strcmp(lutmp->ut_id, utmp_entry->ut_id)) 
+		!strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) 
 	{
 	    return lutmp;
 	}