Skip to content

Commit 45fc5e5

Browse files
committed
memory: add a check to avoid overflow
No caller ran into this, but good to make sure.
1 parent 349779d commit 45fc5e5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/memory/memory.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -502,6 +502,9 @@ bool memory_set_encrypted_seed_and_hmac(const uint8_t* encrypted_seed_and_hmac,
502502
{
503503
chunk_1_t chunk = {0};
504504
CLEANUP_CHUNK(chunk);
505+
if (len > sizeof(chunk.fields.encrypted_seed_and_hmac)) {
506+
return false;
507+
}
505508
_read_chunk(CHUNK_1, chunk_bytes);
506509
chunk.fields.encrypted_seed_and_hmac_len = len;
507510
memset(

0 commit comments

Comments
 (0)