Skip to contentSkip to conversation

dnsproxy: Fix NULL/empty lookup causing potential crash

PATCH New Praveen Kumar 1 participant 1 message Apr 24, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dnsproxy: Fix NULL/empty lookup causing potential crash

In ConnMan through 1.44, the lookup string in ns_resolv in dnsproxy.c can be NULL or an empty string when the TC (Truncated) bit is set in a DNS response. This allows attackers to cause a denial of service (application crash) or possibly execute arbitrary code, because those lookup values lead to incorrect length calculations and incorrect memcpy operations.

This patch includes a check to make sure loookup value is valid before using it. This helps avoid unexpected value when the input is empty or incorrect.

Fixes CVE-2025-32743
---
 src/dnsproxy.c | 4 ++++
 1 file changed, 4 insertions(+)
src/dnsproxy.c +4 -0
index f28a5d75..15917eda 100644
@@ -1686,6 +1686,10 @@ static int ns_resolv(struct server_data *server, struct request_data *req,
 {
 	int sk = -1;
 	const char *lookup = (const char *)name;
+
+	if (!lookup || strlen(lookup) == 0)
+		return -EINVAL;
+
 	int err = ns_try_resolv_from_cache(req, request, lookup);
 
 	if (err > 0)
Signature · 1 line
2.40.0