aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-08-14 21:57:43 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-08-14 21:57:43 +0000
commitcd785fb716769228082ab1fd690d7916e3cc9cee (patch)
tree214020f177965a3899a017c27aa05cb683c93fe8
parentee777c4e5f7335296afe2e32d91e0afd46fbe957 (diff)
downloadbusybox-w32-cd785fb716769228082ab1fd690d7916e3cc9cee.tar.gz
busybox-w32-cd785fb716769228082ab1fd690d7916e3cc9cee.tar.bz2
busybox-w32-cd785fb716769228082ab1fd690d7916e3cc9cee.zip
nmeter: fix read past the end if a buffer. Closes 4594
-rw-r--r--procps/nmeter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/procps/nmeter.c b/procps/nmeter.c
index 48a5b4e26..cded67e56 100644
--- a/procps/nmeter.c
+++ b/procps/nmeter.c
@@ -786,8 +786,10 @@ int nmeter_main(int argc, char **argv)
786 if (argc != 2) 786 if (argc != 2)
787 bb_show_usage(); 787 bb_show_usage();
788 788
789 if (open_read_close("version", buf, sizeof(buf)) > 0) 789 if (open_read_close("version", buf, sizeof(buf)-1) > 0) {
790 is26 = (strstr(buf, " 2.4.")==NULL); 790 buf[sizeof(buf)-1] = '\0';
791 is26 = (strstr(buf, " 2.4.") == NULL);
792 }
791 793
792 // Can use argv[1] directly, but this will mess up 794 // Can use argv[1] directly, but this will mess up
793 // parameters as seen by e.g. ps. Making a copy... 795 // parameters as seen by e.g. ps. Making a copy...