Check if crypt_method null before dereferencing

Make sure crypto_method set before sha-rounds. Only affects newusers.
This commit is contained in:
Skyler Ferrante
2023-05-30 15:00:12 -04:00
committed by GitHub
parent d9f0246611
commit b422e3c316

View File

@@ -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)))) {