libsmb: Fix a signed/unsigned warning
authorVolker Lendecke <vl@samba.org>
Mon, 26 Oct 2020 08:18:57 +0000 (09:18 +0100)
committerJeremy Allison <jra@samba.org>
Wed, 4 Nov 2020 18:55:39 +0000 (18:55 +0000)
"num_bytes" is uint32_t, "received" is uint16_t. The multiplication
seems to implicitly widen "received" to int, leading to a
signed/unsigned warning. This cast makes that warning go away.

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

index 59404bce7bf77d33c08df7bdc566d917075417e3..57fefdc382a6a5a020250375999ad6406b990053 100644 (file)
@@ -465,7 +465,7 @@ static void cli_list_old_done(struct tevent_req *subreq)
                 * I don't think this can wrap. received is
                 * initialized from a 16-bit value.
                 */
-               if (num_bytes < (received * DIR_STRUCT_SIZE + 3)) {
+               if (num_bytes < ((uint32_t)received * DIR_STRUCT_SIZE + 3)) {
                        TALLOC_FREE(subreq);
                        tevent_req_nterror(
                                req, NT_STATUS_INVALID_NETWORK_RESPONSE);