summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2011-09-06 14:01:43 +0200
committerStefan Metzmacher <metze@samba.org>2011-09-07 10:38:08 +0200
commit1a726b88ec74962d0317740bbdf576ddcffb52bc (patch)
tree68170328da231a80ffc032c43d32c855bdf65aaf /source3
parent3643a05ba63ac5d8466dc8391b5d05efeedb5ac4 (diff)
downloadsamba-1a726b88ec74962d0317740bbdf576ddcffb52bc.tar.gz
samba-1a726b88ec74962d0317740bbdf576ddcffb52bc.tar.bz2
samba-1a726b88ec74962d0317740bbdf576ddcffb52bc.zip
s3:smb2_server: use smbd_smb2_request_verify_sizes() in smb2_write.c
metze
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/smb2_write.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/source3/smbd/smb2_write.c b/source3/smbd/smb2_write.c
index a6ad42bc06..b47f8a02a1 100644
--- a/source3/smbd/smb2_write.c
+++ b/source3/smbd/smb2_write.c
@@ -39,11 +39,10 @@ static NTSTATUS smbd_smb2_write_recv(struct tevent_req *req,
static void smbd_smb2_request_write_done(struct tevent_req *subreq);
NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
{
+ NTSTATUS status;
const uint8_t *inhdr;
const uint8_t *inbody;
int i = req->current_idx;
- size_t expected_body_size = 0x31;
- size_t body_size;
uint32_t in_smbpid;
uint16_t in_data_offset;
uint32_t in_data_length;
@@ -54,18 +53,13 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
uint32_t in_flags;
struct tevent_req *subreq;
- inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
- if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
- return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
+ status = smbd_smb2_request_verify_sizes(req, 0x31);
+ if (!NT_STATUS_IS_OK(status)) {
+ return smbd_smb2_request_error(req, status);
}
-
+ inhdr = (const uint8_t *)req->in.vector[i+0].iov_base;
inbody = (const uint8_t *)req->in.vector[i+1].iov_base;
- body_size = SVAL(inbody, 0x00);
- if (body_size != expected_body_size) {
- return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
- }
-
in_smbpid = IVAL(inhdr, SMB2_HDR_PID);
in_data_offset = SVAL(inbody, 0x02);
@@ -75,7 +69,7 @@ NTSTATUS smbd_smb2_request_process_write(struct smbd_smb2_request *req)
in_file_id_volatile = BVAL(inbody, 0x18);
in_flags = IVAL(inbody, 0x2C);
- if (in_data_offset != (SMB2_HDR_BODY + (body_size & 0xFFFFFFFE))) {
+ if (in_data_offset != (SMB2_HDR_BODY + req->in.vector[i+1].iov_len)) {
return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
}