git: 50367e285d40 - stable/13 - pw: Don't return a pointer to an on-stack buffer from grp_set_passwd.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 03 May 2023 00:29:37 UTC
The branch stable/13 has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=50367e285d40a8d94192f1e799de21f32c8136a6
commit 50367e285d40a8d94192f1e799de21f32c8136a6
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-12-05 00:28:22 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-05-03 00:05:05 +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).
Reported by: GCC -Wdangling-pointer
Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D37534
(cherry picked from commit 1055bedbed42dc176468b45b4f167a752ed8868f)
---
usr.sbin/pw/pw_group.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/usr.sbin/pw/pw_group.c b/usr.sbin/pw/pw_group.c
index 1f5979a5dd03..838bafa3e8ba 100644
--- a/usr.sbin/pw/pw_group.c
+++ b/usr.sbin/pw/pw_group.c
@@ -55,7 +55,8 @@ grp_set_passwd(struct group *grp, bool update, int fd, bool precrypted)
int b;
int istty;
struct termios t, n;
- char *p, line[256];
+ static char line[256];
+ char *p;
if (fd == -1)
return;