Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Dec 2022 00:30:34 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1055bedbed42 - main - pw: Don't return a pointer to an on-stack buffer from grp_set_passwd.
Message-ID:  <202212050030.2B50UYka069607@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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).
    
    Reported by:    GCC -Wdangling-pointer
    Reviewed by:    imp, emaste
    Differential Revision:  https://reviews.freebsd.org/D37534
---
 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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202212050030.2B50UYka069607>