summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/util/find_uid.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/util/find_uid.c b/src/util/find_uid.c
index 33c7c5ba7..f4156ce76 100644
--- a/src/util/find_uid.c
+++ b/src/util/find_uid.c
@@ -118,6 +118,9 @@ static errno_t get_uid_from_pid(const pid_t pid, uid_t *uid)
}
}
+ /* Guarantee NULL-termination in case we read the full BUFSIZE somehow */
+ buf[BUFSIZE-1] = '\0';
+
ret = close(fd);
if (ret == -1) {
error = errno;