From 9dbbe9629c3226c2c21518a3c8e6ea75ccc94e75 Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 20 Sep 2026 17:02:56 -0400 Subject: [PATCH] stop parsing if incorrect terminator --- libi2pd_client/Torrents.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libi2pd_client/Torrents.cpp b/libi2pd_client/Torrents.cpp index 9f37b11a..87ee3f8b 100644 --- a/libi2pd_client/Torrents.cpp +++ b/libi2pd_client/Torrents.cpp @@ -88,7 +88,7 @@ namespace torrents len += offset; buf = buf.substr (offset); } - if (buf.empty ()) return 0; // maformed dictionary without terminating 'e' + if (buf.empty () || buf[0] != 'e') return 0; // malformed dictionary without terminating 'e' len++; // 'e' return len; } @@ -109,7 +109,7 @@ namespace torrents len += l; buf = buf.substr (l); } - if (buf.empty ()) return 0; // maformed list without terminating 'e' + if (buf.empty () || buf[0] != 'e') return 0; // malformed list without terminating 'e' len++; // 'e' return len; }