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

This commit is contained in:
PobreGato committed 2026-10-06 19:02:18 -04:00
1 parent 184d6d0ff3
commit cf7f15af0c
1 file changed
+3 -1
+3 -1
View File
@@ -1780,7 +1780,9 @@ namespace transport
void SSU2Session::HandlePayload (const uint8_t * buf, size_t len)
{
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++;