Make sure the PID read from charon.pid is null-terminated.
authorTobias Brunner <tobias@strongswan.org>
Wed, 28 Sep 2011 10:01:47 +0000 (12:01 +0200)
committerTobias Brunner <tobias@strongswan.org>
Wed, 28 Sep 2011 11:57:59 +0000 (13:57 +0200)
src/charon/charon.c

index 96cf0c5..9c6f478 100644 (file)
@@ -242,6 +242,7 @@ static bool check_pidfile()
                        memset(buf, 0, sizeof(buf));
                        if (fread(buf, 1, sizeof(buf), pidfile))
                        {
+                               buf[sizeof(buf) - 1] = '\0';
                                pid = atoi(buf);
                        }
                        fclose(pidfile);