summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2004-11-10 04:52:22 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:05:42 -0500
commit017bf499d44d23c50406fb9647f9a2161be395f0 (patch)
tree8e1bb65e98d2df52d4a32f03460ec79508770f96
parentd1f4ba08df3844a0d6af5e39ac66e724e68c32b3 (diff)
downloadsamba-017bf499d44d23c50406fb9647f9a2161be395f0.tar.gz
samba-017bf499d44d23c50406fb9647f9a2161be395f0.tar.bz2
samba-017bf499d44d23c50406fb9647f9a2161be395f0.zip
r3652: 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 (This used to be commit 4bfc916a2c3b9745f47ce4eaa892cdcc431e19db)
-rw-r--r--source4/libcli/raw/rawtrans.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c
index 32c12382f6..111a7ded2a 100644
--- a/source4/libcli/raw/rawtrans.c
+++ b/source4/libcli/raw/rawtrans.c
@@ -222,7 +222,13 @@ struct smbcli_request *smb_raw_trans_send_backend(struct smbcli_tree *tree,
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 @@ struct smbcli_request *smb_raw_trans_send_backend(struct smbcli_tree *tree,
/* 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);