Re: git: 1055bedbed42 - main - pw: Don't return a pointer to an on-stack buffer from grp_set_passwd.
Date: Thu, 08 Dec 2022 23:40:16 UTC
On Mon, Dec 05, 2022 at 12:30:34AM +0000, John Baldwin wrote: > The branch main has been updated by jhb: > > URL: https://cgit.FreeBSD.org/src/commit/?id=1055bedbed42dc176468b45b4f167a752ed8868f > > 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 > > pw: Don't return a pointer to an on-stack buffer from grp_set_passwd. > > 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