diff options
| author | selsta <selsta@sent.at> | 2026-05-21 22:47:02 +0200 |
|---|---|---|
| committer | selsta <selsta@sent.at> | 2026-05-23 01:01:43 +0200 |
| commit | 7d339778135c44370199f5c84e8c90b3d60f6717 (patch) | |
| tree | af8226165f3af9530598b4c4a93231ecaaf65d72 /src/net/tor_address.cpp | |
| parent | 798aecb8e78b4cb752c4c6b36e49e52474b1d435 (diff) | |
| download | monzero-core-7d339778135c44370199f5c84e8c90b3d60f6717.tar.gz monzero-core-7d339778135c44370199f5c84e8c90b3d60f6717.tar.xz monzero-core-7d339778135c44370199f5c84e8c90b3d60f6717.zip | |
net: canonicalize Tor and I2P hostnames
Diffstat (limited to 'src/net/tor_address.cpp')
| -rw-r--r-- | src/net/tor_address.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/net/tor_address.cpp b/src/net/tor_address.cpp index ac36dbffd..35bd8e9a2 100644 --- a/src/net/tor_address.cpp +++ b/src/net/tor_address.cpp @@ -37,6 +37,7 @@ #include <limits> #include "net/error.h" +#include "net/host.h" #include "serialization/keyvalue_serialization.h" #include "storages/portable_storage.h" #include "string_tools_lexical.h" @@ -112,7 +113,9 @@ namespace net const boost::string_ref port = address.substr(host.size() + (host.size() == address.size() ? 0 : 1)); - MONERO_CHECK(host_check(host)); + std::string normalized_host{host}; + net::canonicalize_host(normalized_host); + MONERO_CHECK(host_check(normalized_host)); std::uint16_t porti = default_port; if (!port.empty() && !epee::string_tools::get_xtype_from_string(porti, std::string{port})) @@ -120,7 +123,7 @@ namespace net static_assert(v2_length <= v3_length, "bad internal host size"); static_assert(v3_length + sizeof(tld) == sizeof(tor_address::host_), "bad internal host size"); - return tor_address{host, porti}; + return tor_address{normalized_host, porti}; } bool tor_address::_load(epee::serialization::portable_storage& src, epee::serialization::section* hparent) |
