Fix bug #7155 - valgrind Conditional jump or move depends on uninitialised value...
authorJeremy Allison <jra@samba.org>
Thu, 18 Feb 2010 20:21:10 +0000 (12:21 -0800)
committerKarolin Seeger <kseeger@samba.org>
Fri, 19 Feb 2010 08:20:54 +0000 (09:20 +0100)
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)

source/smbd/mangle_hash.c

index 7073c3c64eb4129f3acdd5a22e7f3c4cc8a9e317..e081a57484a8ac3083840d5870692a297be7c097 100644 (file)
@@ -335,6 +335,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;