1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-30 19:46:56 +00:00

fix: in check input before calling tr_sha1_from_string() (#2468)

Fixes #2467
This commit is contained in:
Charles Kerr 2022-01-21 17:17:49 -06:00 committed by GitHub
parent 4833723651
commit da4ad59290
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2833,6 +2833,7 @@ void tr_sessionRemoveTorrent(tr_session* session, tr_torrent* tor)
tr_torrent* tr_session::getTorrent(std::string_view info_dict_hash_string) tr_torrent* tr_session::getTorrent(std::string_view info_dict_hash_string)
{ {
auto info_dict_hash = tr_sha1_from_string(std::data(info_dict_hash_string)); return std::size(info_dict_hash_string) == TR_SHA1_DIGEST_STRLEN ?
return this->getTorrent(info_dict_hash); this->getTorrent(tr_sha1_from_string(info_dict_hash_string)) :
nullptr;
} }