From 9e4b5349f23464846da7b57fd36a5597b41e51c8 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 26 Aug 2020 15:54:49 -0700 Subject: [PATCH] s3: libsmb: Change convert_ss2service() and it's one caller to take and return unsigned counts. Getting closer to making _internal_resolve_name() return a pointer to size_t for a count. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- source3/libsmb/namequery.c | 62 ++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index 30e6a7591dd..cc2fad30479 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -1671,42 +1671,46 @@ NTSTATUS name_query(const char *name, int name_type, /******************************************************** Convert an array if struct sockaddr_storage to struct ip_service return false on failure. Port is set to PORT_NONE; - pcount is [in/out] - it is the length of ss_list on input, - and the length of return_iplist on output as we remove any + orig_count is the length of ss_list on input, + *count_out is the length of return_iplist on output as we remove any zero addresses from ss_list. *********************************************************/ static bool convert_ss2service(struct ip_service **return_iplist, const struct sockaddr_storage *ss_list, - int *pcount) + size_t orig_count, + size_t *count_out) { - int i; - int orig_count = *pcount; - int real_count = 0; + size_t i; + size_t real_count = 0; - if (orig_count==0 || !ss_list ) - return False; + if (orig_count == 0 || ss_list == NULL) { + *count_out = 0; + return false; + } /* Filter out zero addrs. */ - for ( i=0; i int. */ if (*return_count < 0) { SAFE_FREE(*return_iplist); -- 2.47.3