← Commit list

cd785fb71

Denis Vlasenko
Denis Vlasenko
2008-08-14
FAILED Duration: 27s

Subject

nmeter: fix read past the end if a buffer. Closes 4594

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/nmeter.c+4 -2
@@ -786,8 +786,10 @@ int nmeter_main(int argc, char **argv)
if (argc != 2)
bb_show_usage();
- if (open_read_close("version", buf, sizeof(buf)) > 0)
- is26 = (strstr(buf, " 2.4.")==NULL);
+ if (open_read_close("version", buf, sizeof(buf)-1) > 0) {
+ buf[sizeof(buf)-1] = '\0';
+ is26 = (strstr(buf, " 2.4.") == NULL);
+ }
// Can use argv[1] directly, but this will mess up
// parameters as seen by e.g. ps. Making a copy...