From 880eafd7e83ba326be7036605179e8de746f4312 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 6 Sep 2011 14:01:43 +0200 Subject: s3:smb2_server: use smbd_smb2_request_verify_sizes() in smb2_getinfo.c metze --- source3/smbd/smb2_getinfo.c | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) (limited to 'source3/smbd/smb2_getinfo.c') diff --git a/source3/smbd/smb2_getinfo.c b/source3/smbd/smb2_getinfo.c index 3c8c690342e..61e0cfa06c3 100644 --- a/source3/smbd/smb2_getinfo.c +++ b/source3/smbd/smb2_getinfo.c @@ -44,11 +44,9 @@ static NTSTATUS smbd_smb2_getinfo_recv(struct tevent_req *req, static void smbd_smb2_request_getinfo_done(struct tevent_req *subreq); NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req) { - const uint8_t *inhdr; + NTSTATUS status; const uint8_t *inbody; int i = req->current_idx; - size_t expected_body_size = 0x29; - size_t body_size; uint8_t in_info_type; uint8_t in_file_info_class; uint32_t in_output_buffer_length; @@ -61,18 +59,12 @@ NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req) uint64_t in_file_id_volatile; 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, 0x29); + 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_info_type = CVAL(inbody, 0x02); in_file_info_class = CVAL(inbody, 0x03); in_output_buffer_length = IVAL(inbody, 0x04); @@ -87,7 +79,7 @@ NTSTATUS smbd_smb2_request_process_getinfo(struct smbd_smb2_request *req) if (in_input_buffer_offset == 0 && in_input_buffer_length == 0) { /* This is ok */ } else if (in_input_buffer_offset != - (SMB2_HDR_BODY + (body_size & 0xFFFFFFFE))) { + (SMB2_HDR_BODY + req->in.vector[i+1].iov_len)) { return smbd_smb2_request_error(req, NT_STATUS_INVALID_PARAMETER); } -- cgit v1.2.1