From: Jeremy Allison Date: Thu, 18 Feb 2010 20:21:10 +0000 (-0800) Subject: Fix bug #7155 - valgrind Conditional jump or move depends on uninitialised value... X-Git-Url: http://git.samba.org/?a=commitdiff_plain;h=fcca63d5fd0b900bc4bdcfbfb21b14f655abbbf7;p=metze%2Fsamba%2Fwip.git Fix bug #7155 - valgrind Conditional jump or move depends on uninitialised value(s) error when "mangling method = hash" The charset array allocated in init_chartest() is allocated by MALLOC, but only some elements of it being set after allocation. Fix is to memset to zero after allocation. Jeremy. (cherry picked from commit a4e8210ba7d6d471cb9f17754244393b9c1e5930) --- diff --git a/source3/smbd/mangle_hash.c b/source3/smbd/mangle_hash.c index 6679b31e9ce4..679487d94ed8 100644 --- a/source3/smbd/mangle_hash.c +++ b/source3/smbd/mangle_hash.c @@ -331,6 +331,7 @@ static void init_chartest( void ) chartest = SMB_MALLOC_ARRAY(unsigned char, 256); SMB_ASSERT(chartest != NULL); + memset(chartest, '\0', 256); for( s = (const unsigned char *)basechars; *s; s++ ) { chartest[*s] |= BASECHAR_MASK;