Skip to content

Commit

Permalink
lib/sgetpwent.c: sgetpwent(): Trim the trailing '\n'
Browse files Browse the repository at this point in the history
Just like the other sget*ent() functions do.

Signed-off-by: Alejandro Colomar <[email protected]>
  • Loading branch information
alejandro-colomar committed Jan 10, 2025
1 parent 77cf47b commit 0eff731
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/sgetpwent.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "prototypes.h"
#include "shadowlog_internal.h"
#include "string/strcmp/streq.h"
#include "string/strtok/stpsep.h"


#define NFIELDS 7
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 0eff731

Please sign in to comment.