diff options
author | Jeremy Allison <jra@samba.org> | 2020-09-08 15:45:32 -0700 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2020-09-15 10:09:37 +0000 |
commit | 2ebf3191f2b87e5402df7faaf590116cfdbb46de (patch) | |
tree | 3923cf8fbdbecb60b1df8abd561a0a7bc729e409 /source4 | |
parent | a8e0d46ead768b669e373b407a5b5339dee3ef0f (diff) | |
download | samba-2ebf3191f2b87e5402df7faaf590116cfdbb46de.tar.gz |
lib: addns: Fix ads_dns_lookup_srv() and functions to return size_t * num servers.
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libcli/resolve/dns_ex.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source4/libcli/resolve/dns_ex.c b/source4/libcli/resolve/dns_ex.c index a2e5551ea26..0bb3ba02287 100644 --- a/source4/libcli/resolve/dns_ex.c +++ b/source4/libcli/resolve/dns_ex.c @@ -268,13 +268,13 @@ done: static struct dns_records_container get_srv_records(TALLOC_CTX *mem_ctx, const char* name) { - struct dns_records_container ret; + struct dns_records_container ret = {0}; char **addrs = NULL; struct dns_rr_srv *dclist; NTSTATUS status; - uint32_t total; - int i; - int count; + size_t total; + size_t i; + size_t count = 0; memset(&ret, 0, sizeof(struct dns_records_container)); /* this is the blocking call we are going to lots of trouble @@ -303,6 +303,13 @@ static struct dns_records_container get_srv_records(TALLOC_CTX *mem_ctx, } c = get_a_aaaa_records(mem_ctx, tmp_str, dclist[i].port); + + /* wrap check */ + if (total + c.count < total) { + /* possibly could just break here instead? */ + TALLOC_FREE(addrs); + return ret; + } total += c.count; if (addrs == NULL) { addrs = c.list; |