Browse Source

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

Eric Andersen 23 years ago
parent
commit
30b32340bd
1 changed files with 1 additions and 1 deletions
  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;
 	}