aboutsummaryrefslogtreecommitdiff
path: root/procps/top.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2014-07-29 17:00:30 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2014-07-29 17:00:30 +0200
commit6c6d37ee4526f77fe07e46f05b0378ce43421e84 (patch)
treec836b61664b45b9fc98348810f55ed24c6140a8e /procps/top.c
parent7df1f1dda1f997c44800d16a9a12cf6cae2ed7e7 (diff)
downloadbusybox-w32-6c6d37ee4526f77fe07e46f05b0378ce43421e84.tar.gz
busybox-w32-6c6d37ee4526f77fe07e46f05b0378ce43421e84.tar.bz2
busybox-w32-6c6d37ee4526f77fe07e46f05b0378ce43421e84.zip
top: fix memset length (sizeof(ptr) vs sizeof(array) problem)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'procps/top.c')
-rw-r--r--procps/top.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/procps/top.c b/procps/top.c
index 62f9421af..3d67c3cfd 100644
--- a/procps/top.c
+++ b/procps/top.c
@@ -536,7 +536,7 @@ static void parse_meminfo(unsigned long meminfo[MI_MAX])
536 FILE *f; 536 FILE *f;
537 int i; 537 int i;
538 538
539 memset(meminfo, 0, sizeof(meminfo)); 539 memset(meminfo, 0, sizeof(meminfo[0]) * MI_MAX);
540 f = xfopen_for_read("meminfo"); 540 f = xfopen_for_read("meminfo");
541 while (fgets(buf, sizeof(buf), f) != NULL) { 541 while (fgets(buf, sizeof(buf), f) != NULL) {
542 char *c = strchr(buf, ':'); 542 char *c = strchr(buf, ':');
@@ -550,7 +550,6 @@ static void parse_meminfo(unsigned long meminfo[MI_MAX])
550 fclose(f); 550 fclose(f);
551} 551}
552 552
553
554static unsigned long display_header(int scr_width, int *lines_rem_p) 553static unsigned long display_header(int scr_width, int *lines_rem_p)
555{ 554{
556 char scrbuf[100]; /* [80] was a bit too low on 8Gb ram box */ 555 char scrbuf[100]; /* [80] was a bit too low on 8Gb ram box */