pidfile_read(): Fix potential integer overflow when reading PID

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2014-11-26 23:02:54 +01:00
parent 5ff7994852
commit a296c2dd00
+1 -1
View File
@@ -149,7 +149,7 @@ pid_t pidfile_read(char *pidfile)
if (fgets(buf, sizeof(buf), fp)) {
errno = 0;
pid = strtoul(buf, NULL, 0);
pid = (pid_t)strtol(buf, NULL, 10);
if (errno)
pid = 0; /* Failed conversion. */
}