libcli/smb: Change some checks to SMB_ASSERTS
authorStefan Metzmacher <metze@samba.org>
Mon, 11 Jan 2021 09:01:39 +0000 (10:01 +0100)
committerVolker Lendecke <vl@samba.org>
Fri, 15 Jan 2021 07:26:29 +0000 (07:26 +0000)
If we end up here, it's definitely a programming error in the basic
parsing layer of the SMB2 packet.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=14607

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
libcli/smb/smb2_signing.c

index 6ece5f2e4d397e6c598b6d9710811eec0b88d530..b1e0253948fe5e9b7f13ba0404ec70659c05b74f 100644 (file)
@@ -189,13 +189,8 @@ NTSTATUS smb2_signing_check_pdu(struct smb2_signing_key *signing_key,
        static const uint8_t zero_sig[16] = { 0, };
        int i;
 
-       if (count < 2) {
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       if (vector[0].iov_len != SMB2_HDR_BODY) {
-               return NT_STATUS_INVALID_PARAMETER;
-       }
+       SMB_ASSERT(count >= 2);
+       SMB_ASSERT(vector[0].iov_len == SMB2_HDR_BODY);
 
        hdr = (const uint8_t *)vector[0].iov_base;