Blob Blame History Raw
From 41866333eccc5bcc6e18dc823efb5fa8748719ce Mon Sep 17 00:00:00 2001
From: Luca Boccassi <luca.boccassi@gmail.com>
Date: Tue, 7 Feb 2017 12:05:17 +0000
Subject: [PATCH] Problem: build error in zsys with GCC7

Solution: use a larger buffer for the PID buffer in zsys_run_as to
avoid a possible overflow.
---
 src/zsys.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/zsys.c b/src/zsys.c
index 13caf667..c0b60305 100644
--- a/src/zsys.c
+++ b/src/zsys.c
@@ -1135,7 +1135,7 @@ zsys_run_as (const char *lockfile, const char *group, const char *user)
             }
         }
         //   We record the current process id in the lock file
-        char pid_buffer [10];
+        char pid_buffer [32];
         snprintf (pid_buffer, sizeof (pid_buffer), "%6" PRIi64 "\n", (int64_t)getpid ());
         if ((size_t) write (handle, pid_buffer, strlen (pid_buffer)) != strlen (pid_buffer)) {
             zsys_error ("cannot write to lockfile: %s", strerror (errno));
-- 
2.11.1