Skip to content

Commit

Permalink
cloudkeychain: check input salt and masterkey lengths to avoid buffer…
Browse files Browse the repository at this point in the history
… overflow
  • Loading branch information
sylvainpelissier authored and solardiz committed Mar 13, 2022
1 parent 75667e2 commit a4ecdf4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/cloudkeychain_common.h
Expand Up @@ -27,7 +27,7 @@ struct custom_salt {
unsigned char masterkey[CTLEN];
unsigned int plaintextlen;
unsigned int ivlen;
unsigned char iv[32];
unsigned char iv[IVLEN];
unsigned int cryptextlen;
unsigned char cryptext[CTLEN];
unsigned int expectedhmaclen;
Expand Down
4 changes: 4 additions & 0 deletions src/cloudkeychain_common_plug.c
Expand Up @@ -37,6 +37,8 @@ int cloudkeychain_valid(char *ciphertext, struct fmt_main *self)
if (!isdec(p))
goto err;
len = atoi(p);
if (len > SALTLEN)
goto err;
if ((p = strtokm(NULL, "$")) == NULL) /* salt */
goto err;
if (hexlenl(p, &extra)/2 != len || extra)
Expand All @@ -50,6 +52,8 @@ int cloudkeychain_valid(char *ciphertext, struct fmt_main *self)
if (!isdec(p))
goto err;
len = atoi(p);
if (len > CTLEN)
goto err;
if ((p = strtokm(NULL, "$")) == NULL) /* masterkey */
goto err;
if (hexlenl(p, &extra)/2 != len || extra)
Expand Down

0 comments on commit a4ecdf4

Please sign in to comment.