summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-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);
}
/*