mirror of
https://github.com/rizinorg/cutter.git
synced 2025-02-07 15:32:13 +00:00
Remove isForbidden()
This commit is contained in:
parent
2105b1fba2
commit
bd600ee737
@ -60,33 +60,11 @@ static const QStringList radareArgs( {
|
|||||||
"#!pipe"
|
"#!pipe"
|
||||||
});
|
});
|
||||||
|
|
||||||
static const QStringList forbiddenArgs({"e", "et", "e-", "e*", "e!", "e?", "env"});
|
|
||||||
|
|
||||||
|
|
||||||
static const int invalidHistoryPos = -1;
|
static const int invalidHistoryPos = -1;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static bool isForbidden(const QString &input)
|
|
||||||
{
|
|
||||||
static const QRegExp delimiters("[;&]");
|
|
||||||
|
|
||||||
|
|
||||||
const QStringList &commands = input.split(delimiters, QString::SkipEmptyParts);
|
|
||||||
|
|
||||||
for (const QString &command : commands) {
|
|
||||||
const QString &trimmedCommand = command.trimmed();
|
|
||||||
|
|
||||||
if (forbiddenArgs.contains(trimmedCommand)) return true;
|
|
||||||
|
|
||||||
for (const QString &arg : forbiddenArgs) {
|
|
||||||
if (trimmedCommand.startsWith(arg + " ")) return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConsoleWidget::ConsoleWidget(MainWindow *main, QAction *action) :
|
ConsoleWidget::ConsoleWidget(MainWindow *main, QAction *action) :
|
||||||
CutterDockWidget(main, action),
|
CutterDockWidget(main, action),
|
||||||
ui(new Ui::ConsoleWidget),
|
ui(new Ui::ConsoleWidget),
|
||||||
@ -218,15 +196,11 @@ void ConsoleWidget::executeCommand(const QString &command)
|
|||||||
void ConsoleWidget::on_inputLineEdit_returnPressed()
|
void ConsoleWidget::on_inputLineEdit_returnPressed()
|
||||||
{
|
{
|
||||||
QString input = ui->inputLineEdit->text();
|
QString input = ui->inputLineEdit->text();
|
||||||
if (!input.isEmpty()) {
|
if (input.isEmpty()) {
|
||||||
if (!isForbidden(input)) {
|
return;
|
||||||
|
}
|
||||||
executeCommand(input);
|
executeCommand(input);
|
||||||
} else {
|
|
||||||
addDebugOutput(tr("command forbidden: ") + input);
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->inputLineEdit->clear();
|
ui->inputLineEdit->clear();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsoleWidget::on_execButton_clicked()
|
void ConsoleWidget::on_execButton_clicked()
|
||||||
|
Loading…
Reference in New Issue
Block a user