]> granicus.if.org Git - procps-ng/commitdiff
top: do not forget the fscanf %s terminating null byte
authorJim Warner <james.warner@comcast.net>
Tue, 3 Dec 2013 21:00:00 +0000 (15:00 -0600)
committerJaromir Capik <jcapik@redhat.com>
Thu, 19 Dec 2013 14:27:11 +0000 (15:27 +0100)
Reference(s):
http://www.freelists.org/post/procps/procpsng-339-defects-found

Signed-off-by: Jim Warner <james.warner@comcast.net>
top/top.c

index 4d1d91266581af1bb2d7feca3508c762e546a4d6..bb15d015ac63cc854c0f320674d0629c43235226 100644 (file)
--- 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