Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jun 2020 17:54:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 247129] [PATCH] Fix some compiler warnings in netinet alias module
Message-ID:  <bug-247129-227-taWKp28AG0@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-247129-227@https.bugs.freebsd.org/bugzilla/>
References:  <bug-247129-227@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D247129

--- Comment #4 from Mark Johnston <markj@FreeBSD.org> ---
(In reply to nikethmurali from comment #3)
A couple more comments:

Changing dlen to be unsigned seems dangerous.  For example, we have:

 450         dlen =3D ntohs(pip->ip_len) - (pip->ip_hl << 2);=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20
 451         if (dlen < ICMP_MINLEN)=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=
=20=20=20=20=20=20
 452                 return (PKT_ALIAS_IGNORED);

What happens if a malicious packet defines a header length longer than ip_l=
en?=20
If dlen is unsigned, it will end up being a large number and will pass the
subsequent check.

Regarding the alignment issue, wouldn't it be simpler to modify each of
ProtoAliasIn/Out and FragmentIn/Out to take a struct ip * as input, and have
them update fields directly?  Then those functions know that the ip address
fields are not necessarily self-aligned and the compiler can handle it.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-247129-227-taWKp28AG0>