From: Pablo Neira Ayuso <pablo@netfilter.org>
To: Chenguang Zhao <chenguang.zhao@linux.dev>
Cc: Aamir Ahmed <elb12345@hotmail.co.uk>,
netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] netfilter: conntrack_amanda: fix port value truncation
Date: Mon, 7 Sep 2026 18:37:43 +0200 [thread overview]
Message-ID: <ap7oV1cftWpjsBiJ@chamomile> (raw)
In-Reply-To: <214d51c6-a71b-4b93-8dd7-6bd1c02b4c3f@linux.dev>
On Mon, Sep 07, 2026 at 02:56:13PM +0800, Chenguang Zhao wrote:
>
> 在 2026/9/7 07:37, Aamir Ahmed 写道:
> > amanda_help() uses simple_strtoul() to parse the port number from
> > Amanda CONNECT replies, passing the result directly through htons()
> > into a __be16. simple_strtoul() returns unsigned long, so values
> > above 65535 are silently truncated by the implicit conversion to u16
> > inside htons().
> >
> > The existing check "port == 0 || len > 5" is insufficient: it
> > catches values that truncate to zero (e.g. 65536) and strings longer
> > than 5 digits, but misses values 65537-99999 whose u16 truncation is
> > non-zero. For example, port 65537 becomes port 1, creating a
> > conntrack expectation for an unintended port.
> >
> > Parse into an unsigned long and explicitly reject values above 65535
> > before the htons() conversion, mirroring the pattern used by the FTP
> > helper's get_port() and the recent IPVS FTP fix (commit
> > e625a9477d12).
Please, specify target tree. This must go to nf-next.
next prev parent reply other threads:[~2026-09-07 16:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-06 23:37 [PATCH] netfilter: conntrack_amanda: fix port value truncation Aamir Ahmed
2026-09-07 6:56 ` Chenguang Zhao
2026-09-07 16:37 ` Pablo Neira Ayuso [this message]
2026-09-08 1:37 ` Aamir Ahmed
2026-09-07 8:33 ` Florian Westphal
2026-09-09 9:39 ` netdev-bot+sashiko
2026-09-09 12:14 ` Florian Westphal
2026-09-09 23:28 ` Aamir Ahmed
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=ap7oV1cftWpjsBiJ@chamomile \
--to=pablo@netfilter.org \
--cc=chenguang.zhao@linux.dev \
--cc=coreteam@netfilter.org \
--cc=elb12345@hotmail.co.uk \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.