Fixes one more minor Coverity issue. Pushed to master and sssd-1-8 under the one-liner rule.
From e6585325c1289f013d53c4483c2065c07df763ee Mon Sep 17 00:00:00 2001 From: Stephen Gallagher <[email protected]> Date: Tue, 14 Feb 2012 07:49:44 -0500 Subject: [PATCH] Ensure NULL-termination in get_uid_from_pid()
Coverity #12399
---
src/util/find_uid.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/util/find_uid.c b/src/util/find_uid.c
index 33c7c5ba7aa585c5fc46dfd06794ba5c26b32588..f4156ce761ee6d9d3b750e1b5e4576152d318b44 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;
--
1.7.7.6
signature.asc
Description: This is a digitally signed message part
_______________________________________________ sssd-devel mailing list [email protected] https://fedorahosted.org/mailman/listinfo/sssd-devel
