diff --git a/src/chgpasswd.c b/src/chgpasswd.c index fe4055d8..7b773e2f 100644 --- a/src/chgpasswd.c +++ b/src/chgpasswd.c @@ -186,6 +186,13 @@ static void process_flags (int argc, char **argv) case 's': sflg = true; bad_s = 0; + + if (!crypt_method) { + fprintf (stderr, + _("%s: no crypt method defined\n"), + Prog); + usage (E_USAGE); + } #if defined(USE_SHA_CRYPT) if ( ( ((0 == strcmp (crypt_method, "SHA256")) || (0 == strcmp (crypt_method, "SHA512"))) && (0 == getlong(optarg, &sha_rounds)))) {