summaryrefslogtreecommitdiff
path: root/src/util/find_uid.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/find_uid.c')
-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 33c7c5ba..f4156ce7 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;