fix writev(vector[...]) points to uninitialised bytes in call_trans2findfirst
authorNoel Power <noel.power@suse.com>
Wed, 28 Oct 2015 15:42:06 +0000 (15:42 +0000)
committerJeremy Allison <jra@samba.org>
Thu, 5 Nov 2015 20:12:09 +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 58d18fbe98751c8adcdf26b083e3f7ac8d7395de..967a56c1145e3d4ea90808627ea49f1cde6e2d33 100644 (file)
@@ -2639,7 +2639,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, 10);
        if (*pparams == NULL) {