From 67d77aa96dccefe68a44473bf45cf6796e741b7d Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Fri, 8 Apr 2011 14:46:54 +0000 Subject: buf and statpost should be checked for NULL before accessing it Signed-off-by: Raghavendra Bhat Signed-off-by: Anand Avati BUG: 2701 ([6db2b422f05d0553d0a83af603ae4d176b41cbdf]: crash in quota_readlink_cbk) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2701 --- xlators/features/quota/src/quota.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'xlators') diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c index 0cf31b52e8a..1911d63e364 100644 --- a/xlators/features/quota/src/quota.c +++ b/xlators/features/quota/src/quota.c @@ -2047,7 +2047,8 @@ quota_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&ctx->lock); { - ctx->buf = *buf; + if (buf) + ctx->buf = *buf; } UNLOCK (&ctx->lock); @@ -2110,7 +2111,8 @@ quota_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&ctx->lock); { - ctx->buf = *buf; + if (buf) + ctx->buf = *buf; } UNLOCK (&ctx->lock); @@ -2352,7 +2354,8 @@ quota_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, LOCK (&ctx->lock); { - ctx->buf = *statpost; + if (statpost) + ctx->buf = *statpost; } UNLOCK (&ctx->lock); -- cgit