Date: Sun, 31 Jan 2021 16:55:56 -0500 From: Shawn Webb <shawn.webb@hardenedbsd.org> To: Edward Tomasz Napierala <trasz@FreeBSD.org> Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: Re: git: 5299d64b2b9f - main - libc: fix buffer overrun in getrpcport(3) Message-ID: <20210131215556.eautrr6esynyic6f@mutt-hbsd> In-Reply-To: <202101312143.10VLhfV5025431@gitrepo.freebsd.org> References: <202101312143.10VLhfV5025431@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--b3ey7svlnh3emv3f Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Jan 31, 2021 at 09:43:41PM +0000, Edward Tomasz Napierala wrote: > The branch main has been updated by trasz: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D5299d64b2b9f7a25e423ef1785= d9402a0ef198d3 >=20 > commit 5299d64b2b9f7a25e423ef1785d9402a0ef198d3 > Author: Edward Tomasz Napierala <trasz@FreeBSD.org> > AuthorDate: 2021-01-31 21:41:55 +0000 > Commit: Edward Tomasz Napierala <trasz@FreeBSD.org> > CommitDate: 2021-01-31 21:42:02 +0000 >=20 > libc: fix buffer overrun in getrpcport(3) > =20 > Reviewed By: markj > Sponsored by: NetApp, Inc. > Sponsored by: Klara, Inc. > Differential Revision: https://reviews.freebsd.org/D27332 > --- > lib/libc/rpc/getrpcport.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) >=20 > diff --git a/lib/libc/rpc/getrpcport.c b/lib/libc/rpc/getrpcport.c > index 2b2d459c8887..4abc9a0c16af 100644 > --- a/lib/libc/rpc/getrpcport.c > +++ b/lib/libc/rpc/getrpcport.c > @@ -62,14 +62,14 @@ getrpcport(char *host, int prognum, int versnum, int = proto) > =20 > assert(host !=3D NULL); > =20 > - if ((hp =3D gethostbyname(host)) =3D=3D NULL) > + if ((hp =3D gethostbyname2(host, AF_INET)) =3D=3D NULL) > return (0); > memset(&addr, 0, sizeof(addr)); > addr.sin_len =3D sizeof(struct sockaddr_in); > addr.sin_family =3D AF_INET; > addr.sin_port =3D 0; > - if (hp->h_length > addr.sin_len) > - hp->h_length =3D addr.sin_len; > + if (hp->h_length > sizeof(addr.sin_addr.s_addr)) > + hp->h_length =3D sizeof(addr.sin_addr.s_addr); > memcpy(&addr.sin_addr.s_addr, hp->h_addr, (size_t)hp->h_length); > /* Inconsistent interfaces need casts! :-( */ > return (pmap_getport(&addr, (u_long)prognum, (u_long)versnum,=20 Does a fix like this need to get a security advisory report? Also, any plans to MFC? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --b3ey7svlnh3emv3f Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAmAXJ2oACgkQ/y5nonf4 4fqAnQ//Uq4QsTUWHsP4aIGXH49HsRNCRJuoe38tzDoVUlLgaqM1PfITAlehNCoe n/ZVHSMH6bby2CbgsQCGBpx1QqDpyle3N6BDjHzBhL+N8GLxzxuYLbpJ+Fmb7E1R QFxZ9dtQlQvSKJzt5+mvksxBHfPxUayOF7ObX88rHq+i+o3Ho7jfVu65T17DOBYa gj6E/P3MgB7zinGdk72AqH/c4Y47J6zUSdD3CK6Hgo1fg5pBWJHON7AV08P2TkUN Nuj70tFQlUtIu3WMR3X5IZs2O2PSmjFLNOa4KCkqAn/AnMcs0RyGEflpoCmvN462 Vx/7tHJiKzPa583/+2Z6LNc8GVQLUTZH8IVYKenWtELHhA/S8E9F0yFX5Cs0TAQs 7hdfNFn+tVhZpeE1jp1x1+E1B8vET0uzJaOWacDdKkyQZ/BoS/J/HeUTctawWmWs JZo9xB09M9kUD0ZFL3kP4l7JI7w7LV78epGCs58Q8TTvECVkSLE9KPzt4zaXqQzq pLZe/sM5CGdr2gI85Na3ya2stKc5gnFAdgfOKCZn+FV9yjU60GmBxFYWv+YuLxVS Ep9nJSMbAgGTbALFjFd2yHFXAhW1v3do5E5W6HqYSta8ouu9MgcvsHdoKmvYLt3e DcJOSxs32qTDsI9/1LIa6qw+C8DsZM2+gDo1AYDdfispYVBpcAw= =sI5R -----END PGP SIGNATURE----- --b3ey7svlnh3emv3f--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210131215556.eautrr6esynyic6f>