From: Alejandro Colomar Date: Tue, 14 May 2024 19:37:53 +0000 (+0200) Subject: src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) X-Git-Tag: 4.17.0-rc1~182 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ac591763febcc05bfefb046cee38f12bb4c1e76f;p=thirdparty%2Fshadow.git src/newusers.c: Exit on ENOMEM, by calling xstrdup() instead of strdup(3) The program was happily ignoring ENOMEM errors. Fixes: 7f9e19690333 ("* NEWS, src/newusers.c, src/Makefile.am: Added support for") Signed-off-by: Alejandro Colomar --- diff --git a/src/newusers.c b/src/newusers.c index f2bd71c09..c28f8d891 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -1206,8 +1206,8 @@ int main (int argc, char **argv) fail_exit (EXIT_FAILURE); } lines[nusers-1] = line; - usernames[nusers-1] = strdup (fields[0]); - passwords[nusers-1] = strdup (fields[1]); + usernames[nusers-1] = xstrdup(fields[0]); + passwords[nusers-1] = xstrdup(fields[1]); #endif /* USE_PAM */ if (add_passwd (&newpw, fields[1]) != 0) { fprintf (stderr,