]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/sgetpwent.c: sgetpwent(): Trim the trailing '\n'
authorAlejandro Colomar <alx@kernel.org>
Sat, 7 Dec 2024 22:29:58 +0000 (23:29 +0100)
committerSerge Hallyn <serge@hallyn.com>
Fri, 30 May 2025 21:11:16 +0000 (16:11 -0500)
Just like the other sget*ent() functions do.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/sgetpwent.c

index 61e1e4ed86bd8496c803457467d0a0d765b6d6f0..691979a193c65e9df012e84d29dd13faffb5670d 100644 (file)
@@ -22,6 +22,7 @@
 #include "prototypes.h"
 #include "shadowlog_internal.h"
 #include "string/strcmp/streq.h"
+#include "string/strtok/stpsep.h"
 
 
 #define        NFIELDS 7
@@ -52,6 +53,8 @@ sgetpwent(const char *s)
        if (dup == NULL)
                return NULL;
 
+       stpsep(dup, "\n");
+
        /*
         * Save a pointer to the start of each colon separated
         * field.  The fields are converted into NUL terminated strings.