[procps] Re: procps-ng 3.3.9 defects found

  • From: Jim Warner <james.warner@xxxxxxxxxxx>
  • To: procps@xxxxxxxxxxxxx
  • Date: Tue, 03 Dec 2013 15:15:13 -0600

On 12/03/2013 03:08 PM, Jaromir Capik wrote:
Sure ... the guys are working really hard to make the tests
absolutely bulletproof. We REALLY want to offer excellent
quality products. And we hope it has a positive impact
on all included software products :]

The uninitialized 'pos' is also harmless, but the bug is there
and I'll fix it by moving the increment to the body of the next
condition.

Jaromir,

As promised, here's the top part.

My compliments to your QA folks...

Jim



>From acc1341ae1b0bd7c319cb9592612910899a7d88c Mon Sep 17 00:00:00 2001
From: Jim Warner <james.warner@xxxxxxxxxxx>
Date: Tue, 3 Dec 2013 15:00:00 -0600
Subject: [PATCH] top: do not forget the fscanf %s terminating null byte

Reference(s):
//www.freelists.org/post/procps/procpsng-339-defects-found

Signed-off-by: Jim Warner <james.warner@xxxxxxxxxxx>
---
 top/top.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/top/top.c b/top/top.c
index 4d1d912..bb15d01 100644
--- a/top/top.c
+++ b/top/top.c
@@ -3445,8 +3445,8 @@ static void configs_read (void) {
          WIN_t *w = &Winstk[i];
          p = fmtmk(N_fmt(RC_bad_entry_fmt), i+1, Rc_name);
 
-         // note: "fieldscur=%__s" on next line should equal PFLAGSSIZ !
-         if (2 != fscanf(fp, "%3s\tfieldscur=%80s\n"
+         // note: "fieldscur=%__s" on next line should equal (PFLAGSSIZ -1) !
+         if (2 != fscanf(fp, "%3s\tfieldscur=%79s\n"
             , w->rc.winname, w->rc.fieldscur))
                goto default_or_error;
 #if PFLAGSSIZ > 80
-- 
1.8.3.2


Other related posts: