diff --git a/src/as400_ssha1_fmt_plug.c b/src/as400_ssha1_fmt_plug.c index 0d5f7e96c28..840d696bda3 100644 --- a/src/as400_ssha1_fmt_plug.c +++ b/src/as400_ssha1_fmt_plug.c @@ -152,6 +152,12 @@ static int our_valid(char *ciphertext, struct fmt_main *self) if (!strncmp(ciphertext, "$dynamic_1590$", 14)) return pDynamic->methods.valid(ciphertext, pDynamic); + if (strncmp(ciphertext, FORMAT_TAG, FORMAT_TAG_LEN)) + return 0; + if (hexlenu(&ciphertext[FORMAT_TAG_LEN], 0) != BINARY_SIZE*2) + return 0; + if (strlen(&ciphertext[FORMAT_TAG_LEN+2*BINARY_SIZE]) > 10) + return 0; if (options.input_enc == UTF_8 && !valid_utf8((UTF8*)ciphertext)) { static int error_shown = 0; #ifdef HAVE_FUZZ @@ -163,12 +169,6 @@ static int our_valid(char *ciphertext, struct fmt_main *self) error_shown = 1; return 0; } - if (strncmp(ciphertext, FORMAT_TAG, FORMAT_TAG_LEN) != 0) - return 0; - if (hexlenu(&ciphertext[FORMAT_TAG_LEN], 0) != BINARY_SIZE*2) - return 0; - if (strlen(&ciphertext[FORMAT_TAG_LEN+2*BINARY_SIZE]) > 10) - return 0; return pDynamic->methods.valid(Convert(Conv_Buf, ciphertext), pDynamic); }