check the whole block header fits before reading block size in ratchets payload

This commit is contained in:
PobreGato committed 2026-10-06 19:02:26 -04:00
1 parent 184d6d0ff3
commit cc77898b95
1 file changed
+3 -1
+3 -1
View File
@@ -395,7 +395,9 @@ namespace garlic
{
if (len < 3) return;
size_t offset = 0;
while (offset < len)
// the block header is three bytes: without all of them the size field below
// would be read past the end of the payload
while (offset + 3 <= len)
{
uint8_t blk = buf[offset];
offset++;