summaryrefslogtreecommitdiffstats
path: root/source3/smbd/smb2_tcon.c
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:03 +0200
commit02f7c37e671c7950619c000b73c5a09ce31c68ac (patch)
tree6407c85a10f299410b54f8ec94983a253e73a34d /source3/smbd/smb2_tcon.c
parentd280d9f945be2d658694c6d4503822e99dc953b5 (diff)
downloadsamba-02f7c37e671c7950619c000b73c5a09ce31c68ac.tar.gz
samba-02f7c37e671c7950619c000b73c5a09ce31c68ac.tar.xz
samba-02f7c37e671c7950619c000b73c5a09ce31c68ac.zip
s3:smb2_server: use smbd_smb2_request_verify_sizes() in smb2_tcon.c
metze
Diffstat (limited to 'source3/smbd/smb2_tcon.c')
-rw-r--r--source3/smbd/smb2_tcon.c32
1 files changed, 8 insertions, 24 deletions
diff --git a/source3/smbd/smb2_tcon.c b/source3/smbd/smb2_tcon.c
index a302b4ea58..4992d18bcc 100644
--- a/source3/smbd/smb2_tcon.c
+++ b/source3/smbd/smb2_tcon.c
@@ -40,8 +40,6 @@ NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req)
int i = req->current_idx;
uint8_t *outhdr;
DATA_BLOB outbody;
- size_t expected_body_size = 0x09;
- size_t body_size;
uint16_t in_path_offset;
uint16_t in_path_length;
DATA_BLOB in_path_buffer;
@@ -55,21 +53,16 @@ NTSTATUS smbd_smb2_request_process_tcon(struct smbd_smb2_request *req)
NTSTATUS status;
bool ok;
- 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, 0x09);
+ if (!NT_STATUS_IS_OK(status)) {
+ return smbd_smb2_request_error(req, status);
}
-
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_path_offset = SVAL(inbody, 0x04);
in_path_length = SVAL(inbody, 0x06);
- if (in_path_offset != (SMB2_HDR_BODY + (body_size & 0xFFFFFFFE))) {
+ if (in_path_offset != (SMB2_HDR_BODY + req->in.vector[i+1].iov_len)) {
return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
}
@@ -280,21 +273,12 @@ static NTSTATUS smbd_smb2_tree_connect(struct smbd_smb2_request *req,
NTSTATUS smbd_smb2_request_process_tdis(struct smbd_smb2_request *req)
{
- const uint8_t *inbody;
- int i = req->current_idx;
+ NTSTATUS status;
DATA_BLOB outbody;
- size_t expected_body_size = 0x04;
- size_t body_size;
- if (req->in.vector[i+1].iov_len != (expected_body_size & 0xFFFFFFFE)) {
- return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER);
- }
-
- 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);
+ status = smbd_smb2_request_verify_sizes(req, 0x04);
+ if (!NT_STATUS_IS_OK(status)) {
+ return smbd_smb2_request_error(req, status);
}
/*