From 73c491e89bb9935d561f3f31ea0ba610e83f1330 Mon Sep 17 00:00:00 2001
From: Matthias Maennich <matthias@maennich.net>
Date: Thu, 5 Oct 2017 14:00:14 +0200
Subject: [PATCH] processUNIX: fix not null terminated buffer during error
 reporting

---
 ProcessUNIX.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ProcessUNIX.c b/ProcessUNIX.c
index 958c9d34..0bc00b89 100644
--- a/ProcessUNIX.c
+++ b/ProcessUNIX.c
@@ -2291,6 +2291,7 @@ static void kwsysProcessChildErrorExit(int errorPipe)
   char buffer[KWSYSPE_PIPE_BUFFER_SIZE];
   kwsysProcess_ssize_t result;
   strncpy(buffer, strerror(errno), KWSYSPE_PIPE_BUFFER_SIZE);
+  buffer[KWSYSPE_PIPE_BUFFER_SIZE - 1] = '\0';
 
   /* Report the error to the parent through the special pipe.  */
   result = write(errorPipe, buffer, strlen(buffer));
-- 
GitLab