Skip to content

Commit

Permalink
gpg formats: harden valid() to fix buffer overflow
Browse files Browse the repository at this point in the history
Related to openwall#5157
  • Loading branch information
AlekseyCherepanov committed Jun 30, 2022
1 parent cd464dd commit b8c3a08
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/gpg_common_plug.c
Expand Up @@ -368,6 +368,8 @@ int gpg_common_valid(char *ciphertext, struct fmt_main *self, int is_CPU_format)
if (!isdec(p))
goto err;
res = atoi(p);
if (res > sizeof(gpg_common_cur_salt->g))
goto err;
if ((p = strtokm(NULL, "*")) == NULL)
goto err;
if (hexlenl(p, &extra) != res*2 || extra)
Expand Down

0 comments on commit b8c3a08

Please sign in to comment.