Skip to content

Commit 568753a

Browse files
committed
merge bitcoin-core/gui#813: Don't permit port in proxy IP option
1 parent dc3771e commit 568753a

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
@@ -22,6 +22,7 @@
2222
#include <validation.h> // for DEFAULT_SCRIPTCHECK_THREADS and MAX_SCRIPTCHECK_THREADS
2323
#include <netbase.h>
2424
#include <txdb.h> // for -dbcache defaults
25+
#include <util/strencodings.h>
2526
#include <util/underlying.h>
2627

2728
#include <QButtonGroup>
@@ -588,7 +589,10 @@ QValidator(parent)
588589
QValidator::State ProxyAddressValidator::validate(QString &input, int &pos) const
589590
{
590591
Q_UNUSED(pos);
591-
// Validate the proxy
592+
uint16_t port{0};
593+
std::string hostname;
594+
if (!SplitHostPort(input.toStdString(), port, hostname) || port != 0) return QValidator::Invalid;
595+
592596
CService serv(LookupNumeric(input.toStdString(), DEFAULT_GUI_PROXY_PORT));
593597
Proxy addrProxy = Proxy(serv, true);
594598
if (addrProxy.IsValid())

0 commit comments

Comments
 (0)