Skip to content

Commit

Permalink
as400-ssha1 format: Add a UTF-8 check in valid() since Convert()
Browse files Browse the repository at this point in the history
depends on correct encoding being used.
  • Loading branch information
magnumripper committed Sep 4, 2016
1 parent cd4cf0d commit 33e4c9f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/as400_ssha1_fmt_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,10 @@ static int our_valid(char *ciphertext, struct fmt_main *self)
if (!strncmp(ciphertext, "$dynamic_1590$", 14))
return pDynamic->methods.valid(ciphertext, pDynamic);

if (options.input_enc == UTF_8 && !valid_utf8((UTF8*)ciphertext)) {
fprintf(stderr, "%s: Input file is not UTF-8. Please use --input-enc to specify a codepage.\n", self->params.label);
error();
}
if (strncmp(ciphertext, FORMAT_TAG, FORMAT_TAG_LEN) != 0)
return 0;
if (hexlenu(&ciphertext[FORMAT_TAG_LEN], 0) != BINARY_SIZE*2)
Expand Down

0 comments on commit 33e4c9f

Please sign in to comment.