Thread (5 messages) 5 messages, 4 authors, 26d ago

Re: [PATCH] netfilter: conntrack_amanda: fix port value truncation

From: Florian Westphal <fw@strlen.de>
Date: 2026-09-07 08:33:23
Also in: lkml, netfilter-devel, stable

Aamir Ahmed [off-list ref] wrote:
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).
Is amanda still a thing?  Maybe time to retire this helper?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help