summaryrefslogtreecommitdiffstats
path: root/xlators/performance
diff options
context:
space:
mode:
authorShyamsundarR <srangana@redhat.com>2018-09-28 13:47:33 -0400
committerShyamsundarR <srangana@redhat.com>2018-09-28 13:49:50 -0400
commitd00a2a1b398346bbdc5ac9b3ba4b09fb1ce1e699 (patch)
tree5816414f3c6da39701053d0b17c01002c0a749cd /xlators/performance
parent7cf6688e9bb8384b383745751758d747a940ca3f (diff)
mdcache: Fix asan reported potential heap buffer overflow
The char pointer mdc_xattr_str in function mdc_xattr_list_populate is malloc'd and doing a strcat into a malloc'd region can overflow content allocated based on prior contents of the memory region. Added a NULL terimation to the malloc'd region to prevent the overflow, and treat it as an empty string. Change-Id: If0decab669551581230a8ede4c44c319ff04bac9 Updates: bz#1633930 Signed-off-by: ShyamsundarR <srangana@redhat.com>
Diffstat (limited to 'xlators/performance')
-rw-r--r--xlators/performance/md-cache/src/md-cache.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/xlators/performance/md-cache/src/md-cache.c b/xlators/performance/md-cache/src/md-cache.c
index 21cc9de081e..b151110a081 100644
--- a/xlators/performance/md-cache/src/md-cache.c
+++ b/xlators/performance/md-cache/src/md-cache.c
@@ -3122,6 +3122,7 @@ mdc_xattr_list_populate(struct mdc_conf *conf, char *tmp_str)
mdc_xattr_str = GF_MALLOC(max_size, gf_common_mt_char);
GF_CHECK_ALLOC(mdc_xattr_str, ret, out);
+ mdc_xattr_str[0] = '\0';
if (conf->cache_capability)
strcat(mdc_xattr_str, "security.capability,");