diff options
author | merge-script <32963518+hebasto@users.noreply.github.com> | 2024-05-11 19:34:12 +0100 |
---|---|---|
committer | merge-script <32963518+hebasto@users.noreply.github.com> | 2024-05-11 19:34:12 +0100 |
commit | 32072866809ade129a3219105f0851606dc9fd38 (patch) | |
tree | b18168bb2a894690b1d985915c20c1e7400d5963 /src/qt | |
parent | 182983c6ab2e037d65303fa13148f39236f2734a (diff) | |
parent | 10c5275ba4532fb1bf54057d2f61fc35b51f1e85 (diff) | |
download | bitcoin-32072866809ade129a3219105f0851606dc9fd38.tar.xz |
Merge bitcoin-core/gui#813: Don't permit port in proxy IP option
10c5275ba4532fb1bf54057d2f61fc35b51f1e85 gui: don't permit port in proxy IP option (willcl-ark)
Pull request description:
Fixes: https://github.com/bitcoin-core/gui/issues/809
Previously it was possible through the GUI to enter an IP address:port into the "Proxy IP" configuration box. After the node was restarted the errant setting would prevent the node starting back up until manually removed from settings.json.
Prevent this with a simple check for ":" in the string. This is acceptable here in the GUI setting because we already fail on a hostname such as "http://x.x.x.x", so it won't cause false positives.
ACKs for top commit:
furszy:
utACK 10c5275ba45
hebasto:
ACK 10c5275ba4532fb1bf54057d2f61fc35b51f1e85, tested on Ubuntu 24.04.
Tree-SHA512: ed83590630cf693680a3221f701ecd18dd08710a17b726dc4978a3a6e330a34fb77d73a4f710c01bcb3faf88b6604ff37bcdbb191ce1623348ca5b92fd6fe9a7
Diffstat (limited to 'src/qt')
-rw-r--r-- | src/qt/optionsdialog.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index 15103baf59..ee53a59bb5 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -18,6 +18,7 @@ #include <node/chainstatemanager_args.h> #include <netbase.h> #include <txdb.h> +#include <util/strencodings.h> #include <chrono> @@ -480,7 +481,10 @@ QValidator(parent) QValidator::State ProxyAddressValidator::validate(QString &input, int &pos) const { Q_UNUSED(pos); - // Validate the proxy + uint16_t port{0}; + std::string hostname; + if (!SplitHostPort(input.toStdString(), port, hostname) || port != 0) return QValidator::Invalid; + CService serv(LookupNumeric(input.toStdString(), DEFAULT_GUI_PROXY_PORT)); Proxy addrProxy = Proxy(serv, true); if (addrProxy.IsValid()) |