mirror of
https://github.com/twisterarmy/twister-core.git
synced 2025-01-22 12:34:24 +00:00
enforce bencoded size. sanity check.
This commit is contained in:
parent
8e80324c36
commit
5ab658ae3d
@ -840,7 +840,9 @@ bool acceptSignedPost(char const *data, int data_size, std::string username, int
|
|||||||
lazy_entry v;
|
lazy_entry v;
|
||||||
int pos;
|
int pos;
|
||||||
libtorrent::error_code ec;
|
libtorrent::error_code ec;
|
||||||
if (lazy_bdecode(data, data + data_size, v, ec, &pos) == 0) {
|
if (data_size <= 0 || data_size > 2048 ) {
|
||||||
|
sprintf(errbuf,"bad bencoded post size");
|
||||||
|
} else if (lazy_bdecode(data, data + data_size, v, ec, &pos) == 0) {
|
||||||
|
|
||||||
if( v.type() == lazy_entry::dict_t ) {
|
if( v.type() == lazy_entry::dict_t ) {
|
||||||
lazy_entry const* post = v.dict_find_dict("userpost");
|
lazy_entry const* post = v.dict_find_dict("userpost");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user