Date: Thu, 8 Dec 2022 23:40:16 +0000 From: Brooks Davis <brooks@freebsd.org> To: John Baldwin <jhb@freebsd.org> Cc: src-committers@freebsd.org, dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org Subject: Re: git: 1055bedbed42 - main - pw: Don't return a pointer to an on-stack buffer from grp_set_passwd. Message-ID: <Y5J14IVwyuCwZ684@spindle.one-eyed-alien.net> In-Reply-To: <202212050030.2B50UYka069607@gitrepo.freebsd.org> References: <202212050030.2B50UYka069607@gitrepo.freebsd.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 05, 2022 at 12:30:34AM +0000, John Baldwin wrote: > The branch main has been updated by jhb: >=20 > URL: https://cgit.FreeBSD.org/src/commit/?id=3D1055bedbed42dc176468b45b4f= 167a752ed8868f >=20 > commit 1055bedbed42dc176468b45b4f167a752ed8868f > Author: John Baldwin <jhb@FreeBSD.org> > AuthorDate: 2022-12-05 00:28:22 +0000 > Commit: John Baldwin <jhb@FreeBSD.org> > CommitDate: 2022-12-05 00:28:22 +0000 >=20 > pw: Don't return a pointer to an on-stack buffer from grp_set_passwd. > =20 > Make 'line' static to move it to .bss instead as that pattern is used > elsewhere in pw(8) (e.g. the static buffer in pw_pwcrypt). It continues to astonish me that compilers allow stack pointers to be returned at any warning level. I think casting the result away completely might manage not to be undefined behavior, but even a dead store is UB. -- Brooks
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Y5J14IVwyuCwZ684>