Fixes to stop valgrind complaining about uninitialised memory when it's
authorJeremy Allison <jra@samba.org>
Sat, 31 May 2003 01:48:59 +0000 (01:48 +0000)
committerJeremy Allison <jra@samba.org>
Sat, 31 May 2003 01:48:59 +0000 (01:48 +0000)
copying clobbered buffer areas and doing hashes on them and sending
them onto the wire.
Jeremy.

source/smbd/connection.c
source/smbd/negprot.c

index 5547309a818591d24401bd36889640b9ba8a199d..92aaebab1f45656aa3c6243f2afa8af2cb28339a 100644 (file)
@@ -41,6 +41,13 @@ static void make_conn_key(connection_struct *conn, const char *name, TDB_DATA *p
        pkey->pid = sys_getpid();
        pkey->cnum = conn?conn->cnum:-1;
        fstrcpy(pkey->name, name);
+#ifdef DEVELOPER
+       {
+               size_t sl = strlen(pkey->name);
+               if (sizeof(fstring)-sl)
+                       memset(&pkey->name[sl], '\0', sizeof(fstring)-sl);
+       }
+#endif
 
        pkbuf->dptr = (char *)pkey;
        pkbuf->dsize = sizeof(*pkey);
index bd1b9b0d572d380b70d6f2108559adf84d62315c..648801e9553995e386b8a348a5fb7df5b4514e1a 100644 (file)
@@ -182,6 +182,15 @@ static int negprot_spnego(char *p)
 
        ZERO_STRUCT(guid);
        safe_strcpy((char *)guid, global_myname(), sizeof(guid)-1);
+
+#ifdef DEVELOPER
+       {
+               size_t sl = strlen(guid);
+               if (sizeof(guid)-sl)
+                       memset(&guid[sl], '\0', sizeof(guid)-sl);
+       }
+#endif
+
        strlower((char *)guid);
 
 #if 0