Skip to content

Commit dedf319

Browse files
willcl-arkfanquake
authored andcommitted
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: bitcoin-core/gui#813 Rebased-From: 10c5275
1 parent d1289a1 commit dedf319

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/qt/optionsdialog.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <node/chainstatemanager_args.h>
2121
#include <netbase.h>
2222
#include <txdb.h>
23+
#include <util/strencodings.h>
2324

2425
#include <chrono>
2526

@@ -478,7 +479,10 @@ QValidator(parent)
478479
QValidator::State ProxyAddressValidator::validate(QString &input, int &pos) const
479480
{
480481
Q_UNUSED(pos);
481-
// Validate the proxy
482+
uint16_t port{0};
483+
std::string hostname;
484+
if (!SplitHostPort(input.toStdString(), port, hostname) || port != 0) return QValidator::Invalid;
485+
482486
CService serv(LookupNumeric(input.toStdString(), DEFAULT_GUI_PROXY_PORT));
483487
Proxy addrProxy = Proxy(serv, true);
484488
if (addrProxy.IsValid())

0 commit comments

Comments
 (0)