Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 3 Jun 2023 21:10:19 GMT
From:      Baptiste Daroussin <bapt@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: fa6fa98ac712 - main - sh(1): initialize smark to zero in main()
Message-ID:  <202306032110.353LAJjo026289@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by bapt:

URL: https://cgit.FreeBSD.org/src/commit/?id=fa6fa98ac712e48fe8e9bca1295b1c54cf744724

commit fa6fa98ac712e48fe8e9bca1295b1c54cf744724
Author:     Daniel Kolesa <q66@chimera-linux.org>
AuthorDate: 2023-06-03 21:08:56 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2023-06-03 21:09:31 +0000

    sh(1): initialize smark to zero in main()
    
    As popstackmark may be called on this without pushstackmark having
    been called, we need to initialize it so that we don't get a bogus
    comparison inside popstackmark, which would have resulted in a
    NULL pointer dereference.
    
    MFC After:      3 days
    Reviewed by:    imp
    Differential Revision:  https://reviews.freebsd.org/D40413
---
 bin/sh/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bin/sh/main.c b/bin/sh/main.c
index bc87440807b2..a77f9528064d 100644
--- a/bin/sh/main.c
+++ b/bin/sh/main.c
@@ -100,7 +100,7 @@ static char *find_dot_file(char *);
 int
 main(int argc, char *argv[])
 {
-	struct stackmark smark, smark2;
+	struct stackmark smark = {0}, smark2;
 	volatile int state;
 	char *shinit;
 



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