check for terminating 'e' for BEncoded disctonaries and lists

This commit is contained in:
orignal committed 2026-09-18 15:40:48 -04:00
1 parent ccf65110dc
commit 00f3ea6691
1 file changed
+4 -2
+4 -2
View File
@@ -84,7 +84,8 @@ namespace torrents
len += offset;
buf = buf.substr (offset);
}
if (buf[0] == 'e') len++;
if (buf.empty ()) return 0; // maformed dictionary without terminating 'e'
len++; // 'e'
return len;
}
@@ -104,7 +105,8 @@ namespace torrents
len += l;
buf = buf.substr (l);
}
if (buf[0] == 'e') len++;
if (buf.empty ()) return 0; // maformed list without terminating 'e'
len++; // 'e'
return len;
}