mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-19 06:57:24 -06:00
Catch possible exceptions when parsing IPs. Closes #7249.
This commit is contained in:
@@ -1262,9 +1262,15 @@ void Session::configurePeerClasses()
|
|||||||
, libt::address_v4::from_string("255.255.255.255")
|
, libt::address_v4::from_string("255.255.255.255")
|
||||||
, 1 << libt::session::global_peer_class_id);
|
, 1 << libt::session::global_peer_class_id);
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
|
// IPv6 may not be available on OS and the parsing
|
||||||
|
// would result in an exception -> abnormal program termination
|
||||||
|
// Affects Windows XP
|
||||||
|
try {
|
||||||
f.add_rule(libt::address_v6::from_string("::0")
|
f.add_rule(libt::address_v6::from_string("::0")
|
||||||
, libt::address_v6::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
|
, libt::address_v6::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
|
||||||
, 1 << libt::session::global_peer_class_id);
|
, 1 << libt::session::global_peer_class_id);
|
||||||
|
}
|
||||||
|
catch(std::exception &) {}
|
||||||
#endif
|
#endif
|
||||||
if (ignoreLimitsOnLAN()) {
|
if (ignoreLimitsOnLAN()) {
|
||||||
// local networks
|
// local networks
|
||||||
@@ -1286,6 +1292,10 @@ void Session::configurePeerClasses()
|
|||||||
, libt::address_v4::from_string("127.255.255.255")
|
, libt::address_v4::from_string("127.255.255.255")
|
||||||
, 1 << libt::session::local_peer_class_id);
|
, 1 << libt::session::local_peer_class_id);
|
||||||
#if TORRENT_USE_IPV6
|
#if TORRENT_USE_IPV6
|
||||||
|
// IPv6 may not be available on OS and the parsing
|
||||||
|
// would result in an exception -> abnormal program termination
|
||||||
|
// Affects Windows XP
|
||||||
|
try {
|
||||||
// link local
|
// link local
|
||||||
f.add_rule(libt::address_v6::from_string("fe80::")
|
f.add_rule(libt::address_v6::from_string("fe80::")
|
||||||
, libt::address_v6::from_string("febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
|
, libt::address_v6::from_string("febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
|
||||||
@@ -1298,6 +1308,8 @@ void Session::configurePeerClasses()
|
|||||||
f.add_rule(libt::address_v6::from_string("::1")
|
f.add_rule(libt::address_v6::from_string("::1")
|
||||||
, libt::address_v6::from_string("::1")
|
, libt::address_v6::from_string("::1")
|
||||||
, 1 << libt::session::local_peer_class_id);
|
, 1 << libt::session::local_peer_class_id);
|
||||||
|
}
|
||||||
|
catch(std::exception &) {}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
m_nativeSession->set_peer_class_filter(f);
|
m_nativeSession->set_peer_class_filter(f);
|
||||||
|
|||||||
Reference in New Issue
Block a user