diff options
author | Michael Scherer <misc@redhat.com> | 2017-02-22 21:46:14 +0100 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2017-02-24 09:37:50 -0500 |
commit | 62d3a2c3fc4e09fe8d1cb05f228715eede1a265d (patch) | |
tree | b76c505b721293344c90c2d8bef69c22c2722918 /libglusterfs | |
parent | 7baa4bdf3a35f1957a37311477cf765fa4e85445 (diff) |
Make sure that buffer is null terminated
Coverity warn about it, and while that's unlikely
to be a issue in practice, it is rather important
to not mask more critical problems with false positive.
Change-Id: Ibee1a9c37e216635077f05d5ef5de55ad5e0b051
BUG: 789278
Signed-off-by: Michael Scherer <misc@redhat.com>
Reviewed-on: https://review.gluster.org/16727
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Niels de Vos <ndevos@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/common-utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c index c0884de8a5e..1e77ebe6f29 100644 --- a/libglusterfs/src/common-utils.c +++ b/libglusterfs/src/common-utils.c @@ -2988,7 +2988,7 @@ gf_get_reserved_ports () goto out; } - ret = sys_read (proc_fd, buffer, sizeof (buffer)); + ret = sys_read (proc_fd, buffer, sizeof (buffer)-1); if (ret < 0) { gf_msg ("glusterfs", GF_LOG_WARNING, errno, LG_MSG_FILE_OP_FAILED, "could not read the file %s for" |