mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2026-10-23 00:01:43 +00:00
check for terminating 'e' for BEncoded disctonaries and lists
This commit is contained in:
1 parent
ccf65110dc
commit
00f3ea6691
1 file changed
+4
-2
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user