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:04 +0200
commit251815bfd395398857cb60c0b89710ddce7ab19f (patch)
tree6c3deb650f44ed59cbe59d6492b6ad06f6b39a56 /source3/smbd
parente09b3940a769806dcc17d24079375f5d53eca26a (diff)
downloadsamba-251815bfd395398857cb60c0b89710ddce7ab19f.tar.gz
samba-251815bfd395398857cb60c0b89710ddce7ab19f.tar.bz2
samba-251815bfd395398857cb60c0b89710ddce7ab19f.zip
s3:smb2_server: use smbd_smb2_request_verify_sizes() in smb2_create.c
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/smb2_create.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/source3/smbd/smb2_create.c b/source3/smbd/smb2_create.c
index 9a60fdad82..2cdc8b55fe 100644
--- a/source3/smbd/smb2_create.c
+++ b/source3/smbd/smb2_create.c
@@ -100,8 +100,6 @@ NTSTATUS smbd_smb2_request_process_create(struct smbd_smb2_request *smb2req)
{
const uint8_t *inbody;
int i = smb2req->current_idx;
- size_t expected_body_size = 0x39;
- size_t body_size;
uint8_t in_oplock_level;
uint32_t in_impersonation_level;
uint32_t in_desired_access;
@@ -127,17 +125,12 @@ NTSTATUS smbd_smb2_request_process_create(struct smbd_smb2_request *smb2req)
bool ok;
struct tevent_req *tsubreq;
- if (smb2req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
- return smbd_smb2_request_error(smb2req, NT_STATUS_INVALID_PARAMETER);
+ status = smbd_smb2_request_verify_sizes(smb2req, 0x39);
+ if (!NT_STATUS_IS_OK(status)) {
+ return smbd_smb2_request_error(smb2req, status);
}
-
inbody = (const uint8_t *)smb2req->in.vector[i+1].iov_base;
- body_size = SVAL(inbody, 0x00);
- if (body_size != expected_body_size) {
- return smbd_smb2_request_error(smb2req, NT_STATUS_INVALID_PARAMETER);
- }
-
in_oplock_level = CVAL(inbody, 0x03);
in_impersonation_level = IVAL(inbody, 0x04);
in_desired_access = IVAL(inbody, 0x18);
@@ -158,7 +151,7 @@ NTSTATUS smbd_smb2_request_process_create(struct smbd_smb2_request *smb2req)
* overlap
*/
- dyn_offset = SMB2_HDR_BODY + (body_size & 0xFFFFFFFE);
+ dyn_offset = SMB2_HDR_BODY + smb2req->in.vector[i+1].iov_len;
if (in_name_offset == 0 && in_name_length == 0) {
/* This is ok */