Skip to content

Commit e1cacb3

Browse files
krzbar-embfabiobaltieri
authored andcommitted
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 <[email protected]>
1 parent 453dfed commit e1cacb3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

subsys/net/lib/dns/resolve.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ int dns_resolve_name(struct dns_resolve_context *ctx,
13001300

13011301
try_resolve:
13021302
#ifdef CONFIG_DNS_RESOLVER_CACHE
1303-
ret = dns_cache_find(&dns_cache, query, cached_info, sizeof(cached_info));
1303+
ret = dns_cache_find(&dns_cache, query, cached_info, ARRAY_SIZE(cached_info));
13041304
if (ret > 0) {
13051305
/* The query was cached, no
13061306
* need to continue further.

0 commit comments

Comments
 (0)