Browse Source

Catch possible exceptions when parsing IPs. Closes #7249.

adaptive-webui-19844
sledgehammer999 7 years ago
parent
commit
31a4309077
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
  1. 12
      src/base/bittorrent/session.cpp

12
src/base/bittorrent/session.cpp

@ -1262,9 +1262,15 @@ void Session::configurePeerClasses() @@ -1262,9 +1262,15 @@ void Session::configurePeerClasses()
, libt::address_v4::from_string("255.255.255.255")
, 1 << libt::session::global_peer_class_id);
#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")
, libt::address_v6::from_string("ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
, 1 << libt::session::global_peer_class_id);
}
catch(std::exception &) {}
#endif
if (ignoreLimitsOnLAN()) {
// local networks
@ -1286,6 +1292,10 @@ void Session::configurePeerClasses() @@ -1286,6 +1292,10 @@ void Session::configurePeerClasses()
, libt::address_v4::from_string("127.255.255.255")
, 1 << libt::session::local_peer_class_id);
#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
f.add_rule(libt::address_v6::from_string("fe80::")
, libt::address_v6::from_string("febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff")
@ -1298,6 +1308,8 @@ void Session::configurePeerClasses() @@ -1298,6 +1308,8 @@ void Session::configurePeerClasses()
f.add_rule(libt::address_v6::from_string("::1")
, libt::address_v6::from_string("::1")
, 1 << libt::session::local_peer_class_id);
}
catch(std::exception &) {}
#endif
}
m_nativeSession->set_peer_class_filter(f);

Loading…
Cancel
Save