projects
/
oweals
/
tinc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3ce5e29
)
Limit field width when scanning PID file.
author
Guus Sliepen
<guus@tinc-vpn.org>
Sun, 2 Jan 2011 15:52:36 +0000
(16:52 +0100)
committer
Guus Sliepen
<guus@tinc-vpn.org>
Sun, 2 Jan 2011 15:52:36 +0000
(16:52 +0100)
Cppcheck warns that scanf() might otherwise crash when presented with a huge,
bogus PID file.
lib/pidfile.c
patch
|
blob
|
history
diff --git
a/lib/pidfile.c
b/lib/pidfile.c
index 47f6359f6ed2da73409b683ccabaaac6b2cd24a2..425b3043a28fdc054f26e03405aad19752eebc0f 100644
(file)
--- a/
lib/pidfile.c
+++ b/
lib/pidfile.c
@@
-41,7
+41,7
@@
pid_t read_pid (char *pidfile)
if (!(f=fopen(pidfile,"r")))
return 0;
- if(fscanf(f,"%ld", &pid) != 1)
+ if(fscanf(f,"%
20
ld", &pid) != 1)
pid = 0;
fclose(f);
return pid;