Check the info-hash target in p.call_target

Without it an unknown info-hash segfaults the process.
This commit is contained in:
noctuum
2026-09-16 10:34:55 +05:00
committed by Jari Sundell
parent 3787dbe7f3
commit 00bcdaee23
+3
View File
@@ -431,6 +431,9 @@ p_call_target(const torrent::Object::list_type& args) {
const std::string& peer_id = itr++->as_string();
const std::string& command_key = itr++->as_string();
if (download == nullptr)
throw torrent::input_error("invalid parameters: info-hash not found");
torrent::HashString hash;
if (peer_id.size() != 40)