diff options
author | nishith-vihar <77044911+nishith-vihar@users.noreply.github.com> | 2021-03-11 22:09:42 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-11 17:39:42 +0100 |
commit | d96e4c8dc5e7095aac0f81852d342e7a7c6238cc (patch) | |
tree | 7439d070b6ac5b6480227b1bd2f46ee4b962858b | |
parent | 45ca8e8650439e2c3cb028f68e1cfd98cb999258 (diff) | |
download | glusterfs-d96e4c8dc5e7095aac0f81852d342e7a7c6238cc.tar.gz glusterfs-d96e4c8dc5e7095aac0f81852d342e7a7c6238cc.tar.xz glusterfs-d96e4c8dc5e7095aac0f81852d342e7a7c6238cc.zip |
String not null terminated (#2219)
CID: 1214629,1274235,1437648
The buffer has been null terminated thus resolving the issue
Change-Id: Ieb1d067d8dd860c55a8091dd6fbba1bcbb4dc19f
Updates: #1060
Signed-off-by: Nishith Vihar Sakinala <nsakinal@redhat.com>
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 408397faa5..e8d0dc114a 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -4422,7 +4422,9 @@ glusterd_gsync_read_frm_status(char *path, char *buf, size_t blen) return -1; } ret = sys_read(status_fd, buf, blen - 1); + if (ret > 0) { + buf[ret] = '\0'; size_t len = strnlen(buf, ret); /* Ensure there is a NUL byte and that it's not the first. */ if (len == 0 || len == blen - 1) { |