s3: Check for the packet size before accessing it
authorVolker Lendecke <vl@samba.org>
Tue, 3 Jan 2012 21:19:27 +0000 (22:19 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 4 Jan 2012 14:16:20 +0000 (15:16 +0100)
Autobuild-User: Jeremy Allison <jra@samba.org>
Autobuild-Date: Wed Jan  4 15:16:20 CET 2012 on sn-devel-104

source3/smbd/process.c

index c44826778188f13bcaf4358cc1628e897598e310..f366600ab8f82c3adee2ab709e80ca6ccc8243f7 100644 (file)
@@ -1409,8 +1409,7 @@ static connection_struct *switch_message(uint8 type, struct smb_request *req, in
 
        /* Make sure this is an SMB packet. smb_size contains NetBIOS header
         * so subtract 4 from it. */
-       if (!valid_smb_header(sconn, req->inbuf)
-           || (size < (smb_size - 4))) {
+       if ((size < (smb_size - 4)) || !valid_smb_header(sconn, req->inbuf)) {
                DEBUG(2,("Non-SMB packet of length %d. Terminating server\n",
                         smb_len(req->inbuf)));
                exit_server_cleanly("Non-SMB packet");