Fixed SOCKS5 proxy detection

`std::stoul` can throw an exception, so don't use it.
This commit is contained in:
SChernykh
2026-02-24 20:35:44 +01:00
parent 23d3a24bc4
commit f05ce6f697
+2 -2
View File
@@ -456,7 +456,7 @@ Params::Params(const std::vector<std::vector<std::string>>& args)
const size_t k = m_socks5Proxy.find_last_of(':');
if ((k != std::string::npos) && (k < m_socks5Proxy.length() - 1)) {
const uint32_t port = std::stoul(m_socks5Proxy.substr(k + 1), nullptr, 10);
const unsigned long port = strtoul(m_socks5Proxy.substr(k + 1).c_str(), nullptr, 10);
if ((port > 0) && (port < 65536)) {
switch (port) {
@@ -524,7 +524,7 @@ bool Params::valid() const
}
if (m_socks5ProxyType == ProxyType::INVALID) {
LOGERR(1, "Invalid SOCKS5 proxy type. Check the --socks5-proxy-type parameter.");
LOGERR(1, "Invalid SOCKS5 proxy type. Check the --socks5 and --socks5-proxy-type parameters.");
return false;
}