From: Johannes Schindelin via GitGitGadget Date: Thu, 27 Feb 2025 15:44:08 GMT Subject: [PATCH 1/2] ident: stop assuming that `gw_gecos` is writable Message-ID: <045c11dc1d51690eed4dc07da26dcace612f786c.1740671049.git.gitgitgadget@gmail.com> In-Reply-To: From: Johannes Schindelin In 590e081dea7c (ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd, 2011-05-19), code was introduced to iterate over the `gw_gecos` field; The loop variable is of type `char *`, which assumes that `gw_gecos` is writable. However, it is not necessarily writable (and it is a bad idea to have it writable in the first place), so let's switch the loop variable type to `const char *`. Signed-off-by: Johannes Schindelin --- ident.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ident.c b/ident.c index caf41fb2a98..967895d8850 100644 --- a/ident.c +++ b/ident.c @@ -59,7 +59,7 @@ static struct passwd *xgetpwuid_self(int *is_bogus) static void copy_gecos(const struct passwd *w, struct strbuf *name) { - char *src; + const char *src; /* Traditionally GECOS field had office phone numbers etc, separated * with commas. Also & stands for capitalized form of the login name. -- gitgitgadget