net: dns: Fix DNS resolver cache invalid find call

The size of the output array for the find call in resolver
is invalid: expected array size while overall memory size
provided. As the latter is bigger there is a high probability
of memory overwrite occurring on the stack.

Signed-off-by: Krzysztof Bartnicki <krzysztof.bartnicki@embevity.com>
This commit is contained in:
Krzysztof Bartnicki 2024-10-03 22:39:56 +02:00 committed by Fabio Baltieri
parent 453dfed3ad
commit e1cacb3a18
1 changed files with 1 additions and 1 deletions

View File

@ -1300,7 +1300,7 @@ int dns_resolve_name(struct dns_resolve_context *ctx,
try_resolve:
#ifdef CONFIG_DNS_RESOLVER_CACHE
ret = dns_cache_find(&dns_cache, query, cached_info, sizeof(cached_info));
ret = dns_cache_find(&dns_cache, query, cached_info, ARRAY_SIZE(cached_info));
if (ret > 0) {
/* The query was cached, no
* need to continue further.