summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix
diff options
context:
space:
mode:
authorHarpreet Kaur <hlalwani@redhat.com>2018-12-14 13:12:26 +0530
committerAmar Tumballi <amarts@redhat.com>2018-12-26 02:17:16 +0000
commitd64fdf867fef36422ab84f2918f5d925597bc7d4 (patch)
treeede3904bb3393f87f5cbe381e7208f28194cfacd /xlators/storage/posix
parent8fe3c6107a2b431d7cc0b8cfaeeb7941cf9590f9 (diff)
posix: stack-buffer-overflow reported by asan
This patch fixes buffer overflow in $SRC/xlators/storage/posix/src/posix-inode-fd-ops.c Memory access at offset 432 overflows "md5_checksum" variable. SUMMARY: AddressSanitizer: stack-buffer-overflow (/lib64/libasan.so.5+0xb825a) updates: bz#1633930 Change-Id: I46010a09161d02cdf0c69679a334ec1d3d49cffb Signed-off-by: Harpreet Kaur <hlalwani@redhat.com>
Diffstat (limited to 'xlators/storage/posix')
-rw-r--r--xlators/storage/posix/src/posix-inode-fd-ops.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix-inode-fd-ops.c b/xlators/storage/posix/src/posix-inode-fd-ops.c
index d2324823592..9867d5fac69 100644
--- a/xlators/storage/posix/src/posix-inode-fd-ops.c
+++ b/xlators/storage/posix/src/posix-inode-fd-ops.c
@@ -5571,7 +5571,9 @@ posix_rchecksum(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
ssize_t bytes_read = 0;
int32_t weak_checksum = 0;
int32_t zerofillcheck = 0;
- unsigned char md5_checksum[MD5_DIGEST_LENGTH] = {0};
+ /* Protocol version 4 uses 32 bytes i.e SHA256_DIGEST_LENGTH,
+ so this is used. */
+ unsigned char md5_checksum[SHA256_DIGEST_LENGTH] = {0};
unsigned char strong_checksum[SHA256_DIGEST_LENGTH] = {0};
unsigned char *checksum = NULL;
struct posix_private *priv = NULL;