]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
src/chfn.c: Add local variable to refer to the separated field
authorAlejandro Colomar <alx@kernel.org>
Mon, 17 Feb 2025 12:44:55 +0000 (13:44 +0100)
committerSerge Hallyn <serge@hallyn.com>
Sun, 2 Mar 2025 22:08:19 +0000 (16:08 -0600)
Tested-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
src/chfn.c

index 1799d6b7cc988a142666e80cffc897835441a1b4..3fc94dce169eed4f388b55e4d7d47e36c395d4d9 100644 (file)
@@ -220,18 +220,20 @@ static char *copy_field (char *in, char *out, char *extra)
        char *cp = NULL;
 
        while (NULL != in) {
+               const char  *f;
+
+               f = in;
                cp = stpsep(in, ",");
 
-               if (strchr (in, '=') == NULL) {
+               if (strchr(f, '=') == NULL)
                        break;
-               }
 
                if (NULL != extra) {
                        if (!streq(extra, "")) {
                                strcat (extra, ",");
                        }
 
-                       strcat (extra, in);
+                       strcat(extra, f);
                }
                in = cp;
        }