From 1da4ba883721e1613c4a0685e0fdd177a55eb07e Mon Sep 17 00:00:00 2001 From: Prashanth Pai Date: Sun, 14 Jun 2015 16:40:58 +0530 Subject: posix: Fix fgetxattr() crash when key name is NULL This is used to get the size of xattr list (to later allocate buffer): glfs_flistxattr(glfd, NULL, 0); glfs_flistxattr() internally has the following call: syncop_fgetxattr (subvol, fd, &xattr, NULL, NULL, NULL); strncmp() segfaults as name is NULL in posix_fgetxattr() Turns out this was a coverity fix in master branch that was not backported to 3.7.x tree. http://review.gluster.org/#/c/10252/ BUG: 1235904 Change-Id: I2ec4715f1ea2f0e9c5314b2dc358bc01ad7b7d45 Signed-off-by: Prashanth Pai Reviewed-on: http://review.gluster.org/11213 Reviewed-by: Raghavendra Talur Tested-by: Gluster Build System Reviewed-by: Raghavendra Bhat --- xlators/storage/posix/src/posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index a2e484e4f8c..b3856cc91ff 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -4163,7 +4163,7 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this, goto done; } - if (strncmp (name, GLUSTERFS_GET_OBJECT_SIGNATURE, + if (name && strncmp (name, GLUSTERFS_GET_OBJECT_SIGNATURE, strlen (GLUSTERFS_GET_OBJECT_SIGNATURE)) == 0) { op_ret = posix_fdget_objectsignature (_fd, dict); if (op_ret < 0) { -- cgit