From 9e93f2d670e45bbce56c5b311289fc474dbce095 Mon Sep 17 00:00:00 2001 From: Rex Dieter Date: Mon, 10 Oct 2016 20:13:57 -0500 Subject: [PATCH] Revert "CVE-2016-7966, KMail: HTML injection in plain text viewer" This reverts commit 29327012f3e94b7bc0901ece479caf14cb9bfce6. --- ...on-in-plan-text-viewer-cve-2016-7966.patch | 197 ------------------ kf5-kcoreaddons.spec | 6 +- 2 files changed, 1 insertion(+), 202 deletions(-) delete mode 100644 0001-kmail-html-injection-in-plan-text-viewer-cve-2016-7966.patch diff --git a/0001-kmail-html-injection-in-plan-text-viewer-cve-2016-7966.patch b/0001-kmail-html-injection-in-plan-text-viewer-cve-2016-7966.patch deleted file mode 100644 index a7112b9..0000000 --- a/0001-kmail-html-injection-in-plan-text-viewer-cve-2016-7966.patch +++ /dev/null @@ -1,197 +0,0 @@ -diff --git a/autotests/ktexttohtmltest.cpp b/autotests/ktexttohtmltest.cpp -index 474f0ca..8fc0c56 100644 ---- a/autotests/ktexttohtmltest.cpp -+++ b/autotests/ktexttohtmltest.cpp -@@ -30,6 +30,15 @@ QTEST_MAIN(KTextToHTMLTest) - - Q_DECLARE_METATYPE(KTextToHTML::Options) - -+#ifndef Q_OS_WIN -+void initLocale() -+{ -+ setenv("LC_ALL", "en_US.utf-8", 1); -+} -+Q_CONSTRUCTOR_FUNCTION(initLocale) -+#endif -+ -+ - void KTextToHTMLTest::testGetEmailAddress() - { - // empty input -@@ -372,6 +381,11 @@ void KTextToHTMLTest::testHtmlConvert_data() - QTest::newRow("url-in-parenthesis-3") << "bla (http://www.kde.org - section 5.2)" - << KTextToHTML::Options(KTextToHTML::PreserveSpaces) - << "bla (http://www.kde.org - section 5.2)"; -+ -+ // Fix url as foo < > when we concatened them. -+ QTest::newRow("url-with-url") << "foo >" -+ << KTextToHTML::Options(KTextToHTML::PreserveSpaces) -+ << "foo <http://www.kde.org/ <http://www.kde.org/>>"; - } - - -diff --git a/src/lib/text/ktexttohtml.cpp b/src/lib/text/ktexttohtml.cpp -index b5e1bda..c70d062 100644 ---- a/src/lib/text/ktexttohtml.cpp -+++ b/src/lib/text/ktexttohtml.cpp -@@ -228,11 +228,19 @@ QString KTextToHTMLHelper::getUrl() - - url.reserve(mMaxUrlLen); // avoid allocs - int start = mPos; -+ bool previousCharIsSpace = false; - while ((mPos < mText.length()) && - (mText[mPos].isPrint() || mText[mPos].isSpace()) && - ((afterUrl.isNull() && !mText[mPos].isSpace()) || - (!afterUrl.isNull() && mText[mPos] != afterUrl))) { -- if (!mText[mPos].isSpace()) { // skip whitespace -+ if (mText[mPos].isSpace()) { -+ previousCharIsSpace = true; -+ } else { // skip whitespace -+ if (previousCharIsSpace && mText[mPos] == QLatin1Char('<')) { -+ url.append(QLatin1Char(' ')); -+ break; -+ } -+ previousCharIsSpace = false; - url.append(mText[mPos]); - if (url.length() > mMaxUrlLen) { - break; -@@ -267,7 +275,6 @@ QString KTextToHTMLHelper::getUrl() - } - } while (url.length() > 1); - } -- - return url; - } - -@@ -334,6 +341,7 @@ QString KTextToHTML::convertToHtml(const QString &plainText, const KTextToHTML:: - QChar ch; - int x; - bool startOfLine = true; -+ //qDebug()<<" plainText"<parseEmoticons(result, true, exclude); - } -+ //qDebug()<<" result "<>" - << KTextToHTML::Options(KTextToHTML::PreserveSpaces) - << "foo <http://www.kde.org/ <http://www.kde.org/>>"; -+ -+ //Fix url exploit -+ QTest::newRow("url-exec-html") << "https://\">