diff options
author | Stephen Gallagher <sgallagh@redhat.com> | 2012-02-14 07:49:44 -0500 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-02-14 07:50:30 -0500 |
commit | 43abd12a37ea1c410ffb923b9cadfbf0f6ea6e6a (patch) | |
tree | 7648ece4f2858ce317bf3bdfea0d93c3f2bf26dd /src/util | |
parent | de5dcfd8e6a8aabd2064cbb86e6c2a3f304b1ca5 (diff) | |
download | sssd-43abd12a37ea1c410ffb923b9cadfbf0f6ea6e6a.tar.gz sssd-43abd12a37ea1c410ffb923b9cadfbf0f6ea6e6a.tar.xz sssd-43abd12a37ea1c410ffb923b9cadfbf0f6ea6e6a.zip |
Ensure NULL-termination in get_uid_from_pid()
Coverity #12399
Diffstat (limited to 'src/util')
-rw-r--r-- | 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 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; |