From 62d3a2c3fc4e09fe8d1cb05f228715eede1a265d Mon Sep 17 00:00:00 2001 From: Michael Scherer Date: Wed, 22 Feb 2017 21:46:14 +0100 Subject: 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 Reviewed-on: https://review.gluster.org/16727 Smoke: Gluster Build System Reviewed-by: Niels de Vos Tested-by: Niels de Vos NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- libglusterfs/src/common-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libglusterfs/src/common-utils.c') 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" -- cgit