From cb01b5e433dacec1217281e69041b322e37a18a3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Wed, 26 Aug 2020 15:45:35 -0700 Subject: [PATCH] s3: libsmb: Make namecache_store() take an unsigned count. Counts can never be negative. Signed-off-by: Jeremy Allison Reviewed-by: Noel Power --- source3/include/proto.h | 2 +- source3/libsmb/namecache.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/source3/include/proto.h b/source3/include/proto.h index ac7b36f005b..dacd9e7fa44 100644 --- a/source3/include/proto.h +++ b/source3/include/proto.h @@ -678,7 +678,7 @@ NTSTATUS dos_to_ntstatus(uint8_t eclass, uint32_t ecode); bool namecache_store(const char *name, int name_type, - int num_names, + size_t num_names, struct ip_service *ip_list); bool namecache_fetch(TALLOC_CTX *ctx, const char *name, diff --git a/source3/libsmb/namecache.c b/source3/libsmb/namecache.c index ae22c2fc26a..76fab4dfce5 100644 --- a/source3/libsmb/namecache.c +++ b/source3/libsmb/namecache.c @@ -40,10 +40,10 @@ static char *ipstr_list_make(TALLOC_CTX *ctx, const struct ip_service *ip_list, - int ip_count) + size_t ip_count) { char *ipstr_list = NULL; - int i; + size_t i; /* arguments checking */ if (ip_list == NULL) { @@ -222,13 +222,13 @@ static char *namecache_key(TALLOC_CTX *ctx, bool namecache_store(const char *name, int name_type, - int num_names, + size_t num_names, struct ip_service *ip_list) { time_t expiry; char *key = NULL; char *value_string = NULL; - int i; + size_t i; bool ret = false; TALLOC_CTX *frame = talloc_stackframe(); @@ -240,7 +240,7 @@ bool namecache_store(const char *name, if ( DEBUGLEVEL >= 5 ) { char *addr = NULL; - DBG_INFO("storing %d address%s for %s#%02x: ", + DBG_INFO("storing %zu address%s for %s#%02x: ", num_names, num_names == 1 ? "": "es", name, name_type); for (i = 0; i < num_names; i++) { -- 2.47.3