diff options
author | Andrew Bartlett <abartlet@samba.org> | 2004-11-10 04:52:22 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:42 -0500 |
commit | 017bf499d44d23c50406fb9647f9a2161be395f0 (patch) | |
tree | 8e1bb65e98d2df52d4a32f03460ec79508770f96 /source4/libcli | |
parent | d1f4ba08df3844a0d6af5e39ac66e724e68c32b3 (diff) | |
download | samba-017bf499d44d23c50406fb9647f9a2161be395f0.tar.gz samba-017bf499d44d23c50406fb9647f9a2161be395f0.tar.xz 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)
Diffstat (limited to 'source4/libcli')
-rw-r--r-- | source4/libcli/raw/rawtrans.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source4/libcli/raw/rawtrans.c b/source4/libcli/raw/rawtrans.c index 32c12382f6a..111a7ded2a1 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); |