From e77eae0f04b90ad9722ce82d59fd552cae63c347 Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Thu, 17 Feb 2011 19:18:12 +0000 Subject: libglusterfs/dict: memcpy() data_t in unserialize. This fixes a race in dht_getxattr() where the xattr dictionary returned by one of the subvolumes can get free'd before STACK_UNWIND, leading to applications seeing junk values. Signed-off-by: Vikas Gorur Signed-off-by: Anand V. Avati BUG: 2442 (getxattr() on a directory sometimes returns junk) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2442 --- libglusterfs/src/dict.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libglusterfs/src/dict.c b/libglusterfs/src/dict.c index ab2487182a1..b351dafd7d1 100644 --- a/libglusterfs/src/dict.c +++ b/libglusterfs/src/dict.c @@ -2596,8 +2596,8 @@ dict_unserialize (char *orig_buf, int32_t size, dict_t **fill) } value = get_new_data (); value->len = vallen; - value->data = buf; - value->is_static = 1; + value->data = memdup (buf, vallen); + value->is_static = 0; buf += vallen; dict_set (*fill, key, value); -- cgit