From efae601c3c4682e15305cce6341d9f3c7ed33ee2 Mon Sep 17 00:00:00 2001 From: Qualys Security Advisory Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] 0047-proc/whattime.c: Always initialize buf. In the human_readable case; otherwise the strcat() that follows may append bytes to the previous contents of buf. Also, slightly enlarge buf, as it was a bit too tight. Could also replace all sprintf()s with snprintf()s, but all the calls here output a limited number of characters, so they should be safe. ---------------------------- adapted for newlib branch . the source file is now proc/uptime.c . function is now named 'procps_uptime_sprint()' . new human readable function 'procps_uptime_sprint_short()' . both were already initialized, so just raised size of 2 buffers Signed-off-by: Jim Warner --- proc/uptime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proc/uptime.c b/proc/uptime.c index d264d4ba..fc714d8e 100644 --- a/proc/uptime.c +++ b/proc/uptime.c @@ -37,8 +37,8 @@ #define UPTIME_FILE "/proc/uptime" -static __thread char upbuf[128]; -static __thread char shortbuf[128]; +static __thread char upbuf[256]; +static __thread char shortbuf[256]; static int count_users(void) {