(print_uptime) [defined BOOT_MSG]:
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 24 Jul 2004 08:03:02 +0000 (08:03 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 24 Jul 2004 08:03:02 +0000 (08:03 +0000)
Don't assume ut_line is null-terminated.

src/uptime.c

index f70d9f125f05620b3dd2d8b19c29e833215651d4..90ffa32c6fc65da85065b59f8191cb5e44c2fffa 100644 (file)
@@ -115,7 +115,7 @@ print_uptime (int n, const STRUCT_UTMP *this)
 # if HAVE_PROC_UPTIME
       if (uptime == 0)
 # endif /* HAVE_PROC_UPTIME */
-       if (STREQ (this->ut_line, BOOT_MSG))
+       if (strncmp (this->ut_line, BOOT_MSG, sizeof this->ut_line) == 0)
          boot_time = UT_TIME_MEMBER (this);
 #endif /* BOOT_MSG */
       ++this;