From 9f45d0f6212d6d5c96dafc4aba73d9d12b39c3d6 Mon Sep 17 00:00:00 2001 From: Poornima G Date: Fri, 28 Feb 2014 12:13:55 +0530 Subject: libglusterfs/inode: Fix NULL dereferences. There could be scenarios where the inode_ctx_get() can be called to only check if the context exists, in such cases the buffer for the context might not have been passed. Hence fix inode_ctx_get() to not crash, when the buffer is not passed. Change-Id: I607d86eb401ccab0e5cd75f6f977c454994ec063 BUG: 789278 Signed-off-by: Poornima G Reviewed-on: http://review.gluster.org/7167 Reviewed-by: Santosh Pradhan Tested-by: Gluster Build System Reviewed-by: Anand Avati --- libglusterfs/src/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'libglusterfs') diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 15e0ccf78..d4eade8ba 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -1599,7 +1599,7 @@ __inode_ctx_get0 (inode_t *inode, xlator_t *xlator, uint64_t *value1) int ret = 0; ret = __inode_ctx_get2 (inode, xlator, &tmp_value, NULL); - if (!ret) + if (!ret && value1) *value1 = tmp_value; return ret; @@ -1612,7 +1612,7 @@ __inode_ctx_get1 (inode_t *inode, xlator_t *xlator, uint64_t *value2) int ret = 0; ret = __inode_ctx_get2 (inode, xlator, NULL, &tmp_value); - if (!ret) + if (!ret && value2) *value2 = tmp_value; return ret; -- cgit