Skip to content

Commit 3207286

Browse files
committed
Merge #813: Don't permit port in proxy IP option
10c5275 gui: don't permit port in proxy IP option (willcl-ark) Pull request description: 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. 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 10c5275 hebasto: ACK 10c5275, tested on Ubuntu 24.04. Tree-SHA512: ed83590630cf693680a3221f701ecd18dd08710a17b726dc4978a3a6e330a34fb77d73a4f710c01bcb3faf88b6604ff37bcdbb191ce1623348ca5b92fd6fe9a7
2 parents 182983c + 10c5275 commit 3207286

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
@@ -18,6 +18,7 @@
1818
#include <node/chainstatemanager_args.h>
1919
#include <netbase.h>
2020
#include <txdb.h>
21+
#include <util/strencodings.h>
2122

2223
#include <chrono>
2324

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

0 commit comments

Comments
 (0)