← Commit list

6c6d37ee4

Denys Vlasenko
Denys Vlasenko
2014-07-29
SUCCESS Duration: 154s

Subject

top: fix memset length (sizeof(ptr) vs sizeof(array) problem)

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

procps/top.c+1 -2
@@ -536,7 +536,7 @@ static void parse_meminfo(unsigned long meminfo[MI_MAX])
FILE *f;
int i;
- memset(meminfo, 0, sizeof(meminfo));
+ memset(meminfo, 0, sizeof(meminfo[0]) * MI_MAX);
f = xfopen_for_read("meminfo");
while (fgets(buf, sizeof(buf), f) != NULL) {
char *c = strchr(buf, ':');
@@ -550,7 +550,6 @@ static void parse_meminfo(unsigned long meminfo[MI_MAX])
fclose(f);
}
-
static unsigned long display_header(int scr_width, int *lines_rem_p)
{
char scrbuf[100]; /* [80] was a bit too low on 8Gb ram box */