diff options
author | Stefan Metzmacher <metze@samba.org> | 2012-08-07 13:00:50 +0200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2012-08-07 18:32:47 +0200 |
commit | 8d63efe27397f0f45b774e04e6146f87a84ba799 (patch) | |
tree | 775c19cab501dd6b8fc0fba0bdbed2cd5cdac015 /source3 | |
parent | 9b8973d3b528169bf70a57f3cc17f35e51dfc81e (diff) | |
download | samba-8d63efe27397f0f45b774e04e6146f87a84ba799.tar.gz samba-8d63efe27397f0f45b774e04e6146f87a84ba799.tar.bz2 samba-8d63efe27397f0f45b774e04e6146f87a84ba799.zip |
s3:smb2_server: use memmove instead of copying single vector elements
metze
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/smb2_server.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 171c999255..fe94d9d658 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1214,14 +1214,16 @@ NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req, req->compound_related = false; req->sconn->smb2.compound_related_in_progress = false; + req->current_idx = 1; + /* Re-arrange the in.vectors. */ - req->in.vector[1] = req->in.vector[i]; - req->in.vector[2] = req->in.vector[i+1]; - req->in.vector[3] = req->in.vector[i+2]; - req->in.vector_count = 4; + memmove(&req->in.vector[req->current_idx], + &req->in.vector[i], + sizeof(req->in.vector[0])*SMBD_SMB2_NUM_IOV_PER_REQ); + req->in.vector_count = req->current_idx + SMBD_SMB2_NUM_IOV_PER_REQ; /* Reset the new in size. */ - smb2_setup_nbt_length(req->in.vector, 4); + smb2_setup_nbt_length(req->in.vector, req->in.vector_count); /* Now recreate the out.vectors. */ outvec = talloc_zero_array(req, struct iovec, 4); @@ -1244,7 +1246,6 @@ NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req, req->out.vector = outvec; - req->current_idx = 1; req->out.vector_count = 4; outhdr = SMBD_SMB2_OUT_HDR_PTR(req); |