summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2012-02-08 22:35:32 +0100
committerCraig Small <csmall@users.sourceforge.net>2012-02-10 07:06:05 +1100
commitd65e2fb891da3797c4d5a62a1adeee6f48d17e02 (patch)
tree1acd923245e1cd0d55b06e5602d46460f610fa32
parent5a3fb35da4bd714bce86c4f5ced344cff1c9ef45 (diff)
killall: fix potential string overflow [cppcheck]
[src/killall.c:138]: (warning) scanf without field width limits can crash with huge input data Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r--src/killall.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/killall.c b/src/killall.c
index 656a335..f108c77 100644
--- a/src/killall.c
+++ b/src/killall.c
@@ -135,7 +135,7 @@ uptime()
}
savelocale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC,"C");
- if (fscanf(file, "%s", buf) == EOF) perror("uptime");
+ if (fscanf(file, "%2047s", buf) == EOF) perror("uptime");
fclose(file);
setlocale(LC_NUMERIC,savelocale);
return atof(buf);