Skip to content

Commit

Permalink
Blockchain format: Fix data over-read bug
Browse files Browse the repository at this point in the history
  • Loading branch information
solardiz committed Jan 5, 2024
1 parent 478b447 commit 0cc2587
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/blockchain_common_plug.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ int blockchain_decrypt(unsigned char *derived_key, unsigned char *data)

// "guid" will be found in the first block
if (memmem(out, 16, "\"guid\"", 6)) {
AES_cbc_encrypt(data + 32, out + 16, SAFETY_FACTOR - 16, &akey, iv,
AES_cbc_encrypt(data + 32, out + 16, SAFETY_FACTOR - 32, &akey, iv,
AES_DECRYPT);
if (memmem(out, SAFETY_FACTOR, "\"sharedKey\"", 11))
if (memmem(out, SAFETY_FACTOR - 16, "\"sharedKey\"", 11))
// Do not check for "options" string. It is too further
// down in the byte stream for v3 wallets. Note, we
// 'could' check that the guid and sharedKey values are
Expand Down

0 comments on commit 0cc2587

Please sign in to comment.