From cf7f15af0cb23ddc24835d6cfb642c0388b1e388 Mon Sep 17 00:00:00 2001 From: PobreGato <315121269+pobregat0@users.noreply.github.com> Date: Wed, 9 Sep 2026 19:48:40 -0400 Subject: [PATCH] check the whole block header fits before reading block size in SSU2 payload --- libi2pd/SSU2Session.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libi2pd/SSU2Session.cpp b/libi2pd/SSU2Session.cpp index 71b2b19c..5b4dee48 100644 --- a/libi2pd/SSU2Session.cpp +++ b/libi2pd/SSU2Session.cpp @@ -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++;