Skip to content

Commit

Permalink
net: dns: Fix DNS resolver cache invalid find call
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
krzbar-emb authored and fabiobaltieri committed Oct 4, 2024
1 parent 453dfed commit e1cacb3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion subsys/net/lib/dns/resolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit e1cacb3

Please sign in to comment.