summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2012-02-14 07:49:44 -0500
committerStephen Gallagher <sgallagh@redhat.com>2012-02-14 07:50:30 -0500
commit43abd12a37ea1c410ffb923b9cadfbf0f6ea6e6a (patch)
tree7648ece4f2858ce317bf3bdfea0d93c3f2bf26dd
parentde5dcfd8e6a8aabd2064cbb86e6c2a3f304b1ca5 (diff)
downloadsssd-43abd12a37ea1c410ffb923b9cadfbf0f6ea6e6a.tar.gz
sssd-43abd12a37ea1c410ffb923b9cadfbf0f6ea6e6a.tar.bz2
sssd-43abd12a37ea1c410ffb923b9cadfbf0f6ea6e6a.zip
Ensure NULL-termination in get_uid_from_pid()
Coverity #12399
-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;