diff options
author | ShyamsundarR <srangana@redhat.com> | 2018-09-28 13:47:33 -0400 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-10-02 18:41:39 +0000 |
commit | 9eeca96885560ee555826ca0eb4294d226928728 (patch) | |
tree | 1371b16d4078dc1e668231d671d2feec34a9742e /xlators | |
parent | 315b45f85ecba15d7fc8f2342468b89ee4747c48 (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#1635373
Signed-off-by: ShyamsundarR <srangana@redhat.com>
(cherry picked from commit d00a2a1b398346bbdc5ac9b3ba4b09fb1ce1e699)
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/performance/md-cache/src/md-cache.c | 1 |
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,"); |