fix writev(vector[...]) points to uninitialised bytes in call_trans2findnext
authorNoel Power <noel.power@suse.com>
Wed, 28 Oct 2015 19:53:49 +0000 (19:53 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 5 Nov 2015 20:12:10 +0000 (21:12 +0100)
Signed-off-by: Noel Power <noel.power@suse.com>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
source3/smbd/trans2.c

index 967a56c1145e3d4ea90808627ea49f1cde6e2d33..e2e4c8047aedc12ac6adb1db97648a01a16c1beb 100644 (file)
@@ -2990,6 +2990,11 @@ total_data=%u (should be %u)\n", (unsigned int)total_data, (unsigned int)IVAL(pd
        pdata = *ppdata;
        data_end = pdata + max_data_bytes + DIR_ENTRY_SAFETY_MARGIN - 1;
 
+       /*
+        * squash valgrind "writev(vector[...]) points to uninitialised byte(s)"
+        * error.
+        */
+       memset(pdata + total_data, 0, (max_data_bytes + DIR_ENTRY_SAFETY_MARGIN) - total_data);
        /* Realloc the params space */
        *pparams = (char *)SMB_REALLOC(*pparams, 6*SIZEOFWORD);
        if(*pparams == NULL ) {