From: Skyler Ferrante Date: Tue, 30 May 2023 19:00:12 +0000 (-0400) Subject: Check if crypt_method null before dereferencing X-Git-Tag: 4.14.0-rc1~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b422e3c31691412f0a5404d09f7b328477e23c48;p=thirdparty%2Fshadow.git Check if crypt_method null before dereferencing Make sure crypto_method set before sha-rounds. Only affects newusers. --- diff --git a/src/newusers.c b/src/newusers.c index ae2224fce..d6b7c3c34 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)))) {