libsmb: Fix a "assuming signed overflow does not occur" error
authorVolker Lendecke <vl@samba.org>
Mon, 18 Mar 2019 08:41:57 +0000 (09:41 +0100)
committerJeremy Allison <jra@samba.org>
Mon, 18 Mar 2019 19:21:24 +0000 (19:21 +0000)
Eventually we need to convert internal_resolve_name to "size_t" for
"return_count". But that's a patch for another day :-)

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/libsmb/namequery.c

index dc563da97980253a2aef7b3853b5e60777244689..f61e2507cce1b385bbda02fd7c54c52411ba5be8 100644 (file)
@@ -3041,8 +3041,8 @@ static NTSTATUS get_dc_list(const char *domain,
        char *port_str = NULL;
        int port;
        char *name;
-       int num_addresses = 0;
-       int  local_count, i, j;
+       size_t num_addresses = 0;
+       size_t local_count, i;
        struct ip_service *return_iplist = NULL;
        struct ip_service *auto_ip_list = NULL;
        bool done_auto_lookup = false;
@@ -3171,6 +3171,7 @@ static NTSTATUS get_dc_list(const char *domain,
                /* copy any addresses from the auto lookup */
 
                if (strequal(name, "*")) {
+                       int j;
                        for (j=0; j<auto_count; j++) {
                                char addr[INET6_ADDRSTRLEN];
                                print_sockaddr(addr,
@@ -3251,7 +3252,7 @@ static NTSTATUS get_dc_list(const char *domain,
        }
 
        if ( DEBUGLEVEL >= 4 ) {
-               DEBUG(4,("get_dc_list: returning %d ip addresses "
+               DEBUG(4,("get_dc_list: returning %zu ip addresses "
                                "in an %sordered list\n",
                                local_count,
                                *ordered ? "":"un"));