From: Denis Kenzior <denkenz@gmail.com>
To: Brian Fukano <bfukano@gmail.com>, connman@lists.linux.dev
Subject: Re: [PATCH] dnsproxy: Fix cached ttl update
Date: Wed, 17 Apr 2024 15:17:09 -0500 [thread overview]
Message-ID: <573bca20-efe7-4421-9a50-eb8111fcf1ca@gmail.com> (raw)
In-Reply-To: <20240408222431.94411-1-bfukano@gmail.com>
Hi Brian,
On 4/8/24 17:24, Brian Fukano 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 | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/src/dnsproxy.c b/src/dnsproxy.c
> index d4242560..506e1b9d 100644
> --- a/src/dnsproxy.c
> +++ b/src/dnsproxy.c
> @@ -508,8 +508,7 @@ static void send_cached_response(int sk, const unsigned char *ptr, size_t len,
> if (answers == 0)
> hdr->aa = 1;
> else {
> - const int adj_len = len - 2;
> - update_cached_ttl((unsigned char *)hdr, adj_len, ttl);
> + update_cached_ttl((unsigned char *)hdr, len, ttl);
Looks like this should be dns_len? Also, the { } around the else are no longer
needed.
https://datatracker.ietf.org/doc/html/rfc1035#section-4.2.2
> }
>
> debug("sk %d id 0x%04x answers %d ptr %p length %zd dns %zd",
Regards,
-Denis
prev parent reply other threads:[~2024-04-17 20:17 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-08 22:24 [PATCH] dnsproxy: Fix cached ttl update Brian Fukano
2024-04-17 20:17 ` Denis Kenzior [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=573bca20-efe7-4421-9a50-eb8111fcf1ca@gmail.com \
--to=denkenz@gmail.com \
--cc=bfukano@gmail.com \
--cc=connman@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).