samba-tng: Reproducible, incomprehensible segfaults

Luke Kenneth Casson Leighton lkcl at samba.org
Wed Feb 16 05:50:45 GMT 2000


> Well, seeing no other solution, I pulled apart the source file, and tracked
> the problem down to the memset calls in lm_owf_gen and lm_owf_genW.  Replacing
> memset() with bzero() fixes the problem.  I have /no/ idea why--but I've
> attached a patch which Works For Me<tm>, and which ought to work for others
> as well.

??????????????????????????
-------------- next part --------------
Index: libsmb/smbencrypt.c
===================================================================
RCS file: /cvsroot/samba/source/libsmb/smbencrypt.c,v
retrieving revision 1.46.2.15
diff -u -w -r1.46.2.15 smbencrypt.c
--- smbencrypt.c	2000/02/13 05:57:56	1.46.2.15
+++ smbencrypt.c	2000/02/16 05:38:00
@@ -139,7 +139,7 @@
 {
 	char pwrd[15];
 
-	memset(pwrd, '\0', 15);
+	bzero(pwrd, 15);
 	if (pwd != NULL)
 	{
 		unistr2_to_ascii(pwrd, pwd, sizeof(pwrd) - 1);
@@ -151,7 +151,7 @@
 
 	/* Calculate the SMB (lanman) hash functions of the password */
 
-	memset(p16, '\0', 16);
+	bzero(p16, 16);
 	E_P16((uchar *) pwrd, (uchar *) p16);
 
 #ifdef DEBUG_PASSWORD
@@ -168,7 +168,7 @@
 {
 	char pwrd[15];
 
-	memset(pwrd, '\0', 15);
+	bzero(pwrd, 15);
 	if (pwd != NULL)
 	{
 		safe_strcpy(pwrd, pwd, sizeof(pwrd) - 1);
@@ -180,7 +180,7 @@
 
 	/* Calculate the SMB (lanman) hash functions of the password */
 
-	memset(p16, '\0', 16);
+	bzero(p16, 16);
 	E_P16((uchar *) pwrd, (uchar *) p16);
 
 #ifdef DEBUG_PASSWORD


More information about the samba-technical mailing list