summaryrefslogtreecommitdiff
path: root/source3/smbd
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:06 +0200
commita358eee2d8670d4a1675e82562fa704fa45a71e6 (patch)
tree8173e9ef46b12738d33d7378148507a7a9fcdcf6 /source3/smbd
parent22d479f75794b7c5fcac2fd47fbfd767700507d6 (diff)
downloadsamba-a358eee2d8670d4a1675e82562fa704fa45a71e6.tar.gz
samba-a358eee2d8670d4a1675e82562fa704fa45a71e6.tar.bz2
samba-a358eee2d8670d4a1675e82562fa704fa45a71e6.zip
s3:smb2_server: use smbd_smb2_request_verify_sizes() in smb2_lock.c
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/smb2_lock.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/source3/smbd/smb2_lock.c b/source3/smbd/smb2_lock.c
index 5d615e1bed..ed1d688cfc 100644
--- a/source3/smbd/smb2_lock.c
+++ b/source3/smbd/smb2_lock.c
@@ -58,8 +58,6 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req)
const uint8_t *inhdr;
const uint8_t *inbody;
const int i = req->current_idx;
- size_t expected_body_size = 0x30;
- size_t body_size;
uint32_t in_smbpid;
uint16_t in_lock_count;
uint64_t in_file_id_persistent;
@@ -68,19 +66,15 @@ NTSTATUS smbd_smb2_request_process_lock(struct smbd_smb2_request *req)
struct tevent_req *subreq;
const uint8_t *lock_buffer;
uint16_t l;
+ NTSTATUS status;
- 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, 0x30);
+ 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_lock_count = CVAL(inbody, 0x02);