libsmb: Fix CID 1438244 Unsigned compared against 0
authorVolker Lendecke <vl@samba.org>
Wed, 8 Aug 2018 08:08:38 +0000 (10:08 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 8 Aug 2018 18:22:05 +0000 (20:22 +0200)
ndr_size_dom_sid returns a size_t, so that can't be <0. Also, the only
case that ndr_size_dom_sid returns 0 is a NULL sid
pointer. ndr_size_dom_sid can reasonably be assumed to not overflow, the
number of sub-auths is a uint8. That times 4 plus 8 always fits into a
size_t.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/libsmb/cli_smb2_fnum.c

index 3537932c0d08481ae89ae65223ac240ea5f33eef..74f2f2ec4e42bdfd395b9e7b1a9bc022565421dd 100644 (file)
@@ -2943,10 +2943,6 @@ NTSTATUS cli_smb2_get_user_quota(struct cli_state *cli,
        sid_len = ndr_size_dom_sid(&pqt->sid, 0);
 
        query.return_single = 1;
-       if (sid_len < 0) {
-               status = NT_STATUS_INVALID_PARAMETER;
-               goto fail;
-       }
 
        info.next_entry_offset = 0;
        info.sid_length = sid_len;