From 97c9cf3e21460a2292c108e676703cdeb826a22f Mon Sep 17 00:00:00 2001 From: iwubcode Date: Mon, 13 Jul 2020 00:26:43 -0500 Subject: DolphinQt / InputCommon - add DSU string validator to avoid crashes, limited backwards compatibility support --- .../ControllerInterface/ServerStringValidator.cpp | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp (limited to 'Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp') diff --git a/Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp b/Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp new file mode 100644 index 0000000000..1ab0935b53 --- /dev/null +++ b/Source/Core/DolphinQt/Config/ControllerInterface/ServerStringValidator.cpp @@ -0,0 +1,23 @@ +// Copyright 2020 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinQt/Config/ControllerInterface/ServerStringValidator.h" + +ServerStringValidator::ServerStringValidator(QObject* parent) : QValidator(parent) +{ +} + +QValidator::State ServerStringValidator::validate(QString& input, int& pos) const +{ + if (input.isEmpty()) + return Invalid; + + if (input.contains(QStringLiteral(":"))) + return Invalid; + + if (input.contains(QStringLiteral(";"))) + return Invalid; + + return Acceptable; +} -- cgit v1.2.3