summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSkyler Ferrante <sjf5462@rit.edu>2023-05-30 15:00:12 -0400
committerGitHub <noreply@github.com>2023-05-30 14:00:12 -0500
commitb422e3c31691412f0a5404d09f7b328477e23c48 (patch)
tree98a1e929d3a723070c499841e63a0d142c1f9871
parentd9f0246611aea527f21c15256a6340c618f22d73 (diff)
Check if crypt_method null before dereferencing
Make sure crypto_method set before sha-rounds. Only affects newusers.
-rw-r--r--src/newusers.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/newusers.c b/src/newusers.c
index ae2224fc..d6b7c3c3 100644
--- a/src/newusers.c
+++ b/src/newusers.c
@@ -662,6 +662,13 @@ static void process_flags (int argc, char **argv)
case 's':
sflg = true;
bad_s = 0;
+
+ if (!crypt_method){
+ fprintf(stderr,
+ _("%s: Provide '--crypt-method'\n"),
+ Prog);
+ usage (EXIT_FAILURE);
+ }
#if defined(USE_SHA_CRYPT)
if ( ( ((0 == strcmp (crypt_method, "SHA256")) || (0 == strcmp (crypt_method, "SHA512")))
&& (0 == getlong(optarg, &sha_rounds)))) {