blob: cce11d8b4f5c7ee2afa3c7bbf4f94ed9a1f37e75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
From 5eda179a099ba68a20dc21dc0da63e85a565a171 Mon Sep 17 00:00:00 2001
From: Martin Sandsmark <martin.sandsmark@kde.org>
Date: Fri, 9 Sep 2016 09:05:57 +0200
Subject: [PATCH] Make sure people are not trying to sneak invisible characters
on the kdesu label
i18n: Sorry for the new string
CCMAIL: kde-i18n-doc@kde.org
---
kdesu/kdesu.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/kdesu/kdesu.cpp b/kdesu/kdesu.cpp
index b7a66a2..b0efbc7 100644
--- a/kdesu/kdesu.cpp
+++ b/kdesu/kdesu.cpp
@@ -162,6 +162,10 @@ int main(int argc, char *argv[])
{
KMessageBox::sorry(0, i18n("Cannot execute command '%1'.", QString::fromLocal8Bit(command)));
}
+ if (result == -2)
+ {
+ KMessageBox::sorry(0, i18n("Cannot execute command '%1'. It contains invalid characters.", QString::fromLocal8Bit(command)));
+ }
return result;
}
@@ -387,6 +391,12 @@ static int startApp(QCommandLineParser& p)
qDebug() << "Don't need password!!\n";
}
+ for (const QChar character : QString::fromLocal8Bit(command)) {
+ if (!character.isPrint() && character.category() != QChar::Other_Surrogate) {
+ return -2;
+ }
+ }
+
// Start the dialog
QString password;
if (needpw)
--
2.7.3
|