mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-04 21:29:21 +00:00
Reject an over-long or empty object_storage key
key_type stores a key of key_size or longer as the empty key.
This commit is contained in:
@@ -64,8 +64,12 @@ object_storage::insert(const char* key_data, uint32_t key_size, const torrent::O
|
||||
if (std::find(key_data, key_data + key_size, '\0') != key_data + key_size)
|
||||
throw torrent::input_error("Found nul-char in string.");
|
||||
|
||||
// Check for size > key_size.
|
||||
// Check for empty string.
|
||||
// key_type turns a key this long into the empty key.
|
||||
if (key_size >= object_storage::key_size)
|
||||
throw torrent::input_error("Key is too long.");
|
||||
|
||||
if (key_size == 0)
|
||||
throw torrent::input_error("Key is empty.");
|
||||
|
||||
bool use_raw = false;
|
||||
torrent::Object object;
|
||||
|
||||
Reference in New Issue
Block a user