Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 May 2023 00:29:37 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 50367e285d40 - stable/13 - pw: Don't return a pointer to an on-stack buffer from grp_set_passwd.
Message-ID:  <202305030029.3430TbNe071957@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



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