Skip to content

Commit 72366a3

Browse files
committed
memory: add a check to avoid overflow
No caller ran into this, but good to make sure.
1 parent 664d21c commit 72366a3

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
@@ -504,6 +504,9 @@ bool memory_set_encrypted_seed_and_hmac(const uint8_t* encrypted_seed_and_hmac,
504504
{
505505
chunk_1_t chunk = {0};
506506
CLEANUP_CHUNK(chunk);
507+
if (len > sizeof(chunk.fields.encrypted_seed_and_hmac)) {
508+
return false;
509+
}
507510
_read_chunk(CHUNK_1, chunk_bytes);
508511
chunk.fields.encrypted_seed_and_hmac_len = len;
509512
memset(

0 commit comments

Comments
 (0)