diff mbox series

[v2] dnsproxy: Fix cached ttl update

Message ID 20240422193805.123689-1-bfukano@gmail.com (mailing list archive)
State Accepted
Commit 3ba031745fe0ece6676bea7fe3ee03e4736fac66
Headers show
Series [v2] dnsproxy: Fix cached ttl update | expand

Commit Message

Brian Fukano April 22, 2024, 7:38 p.m. UTC
This bug was exposed after fixing the signedness comparison warnings
found in dnsproxy.c update_cached_ttl() consistently comes up two
bytes short when processing the last record.
---
 src/dnsproxy.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

patchwork-bot+connman@kernel.org April 22, 2024, 10:50 p.m. UTC | #1
Hello:

This patch was applied to connman.git (master)
by Denis Kenzior <denkenz@gmail.com>:

On Mon, 22 Apr 2024 12:38:05 -0700 you wrote:
> This bug was exposed after fixing the signedness comparison warnings
> found in dnsproxy.c update_cached_ttl() consistently comes up two
> bytes short when processing the last record.
> ---
>  src/dnsproxy.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)

Here is the summary with links:
  - [v2] dnsproxy: Fix cached ttl update
    https://git.kernel.org/pub/scm/network/connman/connman.git/?id=3ba031745fe0

You are awesome, thank you!
diff mbox series

Patch

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index d4242560..23015f74 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -507,10 +507,8 @@  static void send_cached_response(int sk, const unsigned char *ptr, size_t len,
 	/* if this is a negative reply, we are authoritative */
 	if (answers == 0)
 		hdr->aa = 1;
-	else {
-		const int adj_len = len - 2;
-		update_cached_ttl((unsigned char *)hdr, adj_len, ttl);
-	}
+	else
+		update_cached_ttl((unsigned char *)hdr, dns_len, ttl);
 
 	debug("sk %d id 0x%04x answers %d ptr %p length %zd dns %zd",
 		sk, hdr->id, answers, ptr, len, dns_len);