From 2cb3deec72875df22457e96aea18ffa558393e05 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Mon, 20 May 2024 16:22:56 +0200 Subject: [PATCH] lib/shadow.c: my_sgetspent(): Clarify that we're assigning an empty string Signed-off-by: Alejandro Colomar --- lib/shadow.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/shadow.c b/lib/shadow.c index f17d09ee7..ab8f5d2a5 100644 --- a/lib/shadow.c +++ b/lib/shadow.c @@ -60,11 +60,12 @@ void endspent (void) static struct spwd *my_sgetspent (const char *string) { - static char spwbuf[BUFSIZ]; - static struct spwd spwd; - char *fields[FIELDS]; - char *cp; - int i; + int i; + char *fields[FIELDS]; + char *cp; + static char spwbuf[BUFSIZ]; + static char empty[] = ""; + static struct spwd spwd; /* * Copy string to local buffer. It has to be tokenized and we @@ -94,7 +95,7 @@ static struct spwd *my_sgetspent (const char *string) } if (i == (FIELDS - 1)) - fields[i++] = cp; + fields[i++] = empty; if ((cp && *cp) || (i != FIELDS && i != OFIELDS)) return 0; -- 2.47.3