s3:smb2_server: prepare smbd_smb2_request_verify_sizes() for the optimized recvfile...
authorStefan Metzmacher <metze@samba.org>
Mon, 18 Nov 2013 12:46:10 +0000 (13:46 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 11 Apr 2014 19:41:08 +0000 (21:41 +0200)
For recvfile we haven't read and may not allocated the dyn buffer.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/smbd/smb2_server.c

index 4949fd2accb431f0527c0c082a52a5b11c433886..0e42b7fdf713cbdddc1f8057ef8b38815a258788 100644 (file)
@@ -1870,6 +1870,15 @@ NTSTATUS smbd_smb2_request_verify_sizes(struct smbd_smb2_request *req,
        case SMB2_OP_GETINFO:
                min_dyn_size = 0;
                break;
+       case SMB2_OP_WRITE:
+               if (req->smb1req != NULL && req->smb1req->unread_bytes > 0) {
+                       if (req->smb1req->unread_bytes < min_dyn_size) {
+                               return NT_STATUS_INVALID_PARAMETER;
+                       }
+
+                       min_dyn_size = 0;
+               }
+               break;
        }
 
        /*