aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwillcl-ark <will@256k1.dev>2024-04-04 21:08:38 +0100
committerfanquake <fanquake@gmail.com>2024-05-13 11:58:00 +0800
commitdedf319b08d5b76dc1752d8bc4e14d38dc54e100 (patch)
treed66852e7ac28b2c6548d11f7aeb4e25ceddb0d4e
parentd1289a13006f43afa812f7ee8956f3d59449cfd0 (diff)
gui: don't permit port in proxy IP option
Fixes: #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. Github-Pull: https://github.com/bitcoin-core/gui/pull/813 Rebased-From: 10c5275ba4532fb1bf54057d2f61fc35b51f1e85
-rw-r--r--src/qt/optionsdialog.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp
index a87bef796c..ab8e25fd27 100644
--- a/src/qt/optionsdialog.cpp
+++ b/src/qt/optionsdialog.cpp
@@ -20,6 +20,7 @@
#include <node/chainstatemanager_args.h>
#include <netbase.h>
#include <txdb.h>
+#include <util/strencodings.h>
#include <chrono>
@@ -478,7 +479,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())