svn commit: samba r3652 - in branches/SAMBA_4_0/source/libcli/raw: .

abartlet at samba.org abartlet at samba.org
Wed Nov 10 04:52:22 GMT 2004


Author: abartlet
Date: 2004-11-10 04:52:22 +0000 (Wed, 10 Nov 2004)
New Revision: 3652

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3652

Log:
Fix malloc-history dependent failures in smbtorture.

Because -r 3591 removed the over-allocation, realloc() had a chance of
returning a different pointer.  This broke the length calculations in
the trans2 send code.

I think the length calculations coudld be better expressed (less cute
PTR_DIFF tricks) but I'm not going to touch this any more than I need
to.

Andrew Bartlett

Modified:
   branches/SAMBA_4_0/source/libcli/raw/rawtrans.c


Changeset:
Modified: branches/SAMBA_4_0/source/libcli/raw/rawtrans.c
===================================================================
--- branches/SAMBA_4_0/source/libcli/raw/rawtrans.c	2004-11-10 03:08:59 UTC (rev 3651)
+++ branches/SAMBA_4_0/source/libcli/raw/rawtrans.c	2004-11-10 04:52:22 UTC (rev 3652)
@@ -222,7 +222,13 @@
 	if (!req) {
 		return NULL;
 	}
-	
+
+	/* Watch out, this changes the req->out.* pointers */
+	if (command == SMBtrans && parms->in.trans_name) {
+		namelen = smbcli_req_append_string(req, parms->in.trans_name, 
+						STR_TERMINATE);
+	}
+
 	/* fill in SMB parameters */
 	outparam = req->out.data + padding;
 	outdata = outparam + parms->in.params.length;
@@ -230,11 +236,6 @@
 	/* make sure we don't leak data via the padding */
 	memset(req->out.data, 0, padding);
 
-	if (command == SMBtrans && parms->in.trans_name) {
-		namelen = smbcli_req_append_string(req, parms->in.trans_name, 
-						STR_TERMINATE);
-	}
-
 	/* primary request */
 	SSVAL(req->out.vwv,VWV(0),parms->in.params.length);
 	SSVAL(req->out.vwv,VWV(1),parms->in.data.length);



More information about the samba-cvs mailing list