From a09778896cdba87b29299fa83edf0635d4f7785e Mon Sep 17 00:00:00 2001 From: nowrep Date: Thu, 3 Nov 2011 20:12:35 +0100 Subject: [PATCH] Serializing strings from ssl certificates This is only start, all strings from web pages are going to be serialized until 1.0.0 stable See http://labs.qt.nokia.com/2011/10/04/security-considerations- --- src/tools/certificateinfowidget.cpp | 8 ++++---- src/tools/certificateinfowidget.h | 1 + src/webview/tabwidget.cpp | 2 ++ src/webview/tabwidget.h | 6 ++++-- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/tools/certificateinfowidget.cpp b/src/tools/certificateinfowidget.cpp index 1d949ed8a..ccfc3b341 100644 --- a/src/tools/certificateinfowidget.cpp +++ b/src/tools/certificateinfowidget.cpp @@ -17,7 +17,6 @@ * ============================================================ */ #include "certificateinfowidget.h" #include "ui_certificateinfowidget.h" -#include QString CertificateInfoWidget::certificateItemText(const QSslCertificate &cert) { @@ -32,10 +31,11 @@ QString CertificateInfoWidget::certificateItemText(const QSslCertificate &cert) QString CertificateInfoWidget::clearCertSpecialSymbols(const QString &string) { - if (!string.contains("\\")) - return string; + QString n = Qt::escape(string); + + if (!n.contains("\\")) + return n; - QString n = string; //Credits to http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/176679?help-en n.replace("\\xC3\\x80", "A"); n.replace("\\xC3\\x81", "A"); n.replace("\\xC3\\x82", "A"); n.replace("\\xC3\\x83", "A"); n.replace("\\xC3\\x84", "A"); n.replace("\\xC3\\x85", "A"); n.replace("\\xC3\\x86", "AE"); n.replace("\\xC3\\x87", "C"); diff --git a/src/tools/certificateinfowidget.h b/src/tools/certificateinfowidget.h index 8d7de5663..a0a6a792c 100644 --- a/src/tools/certificateinfowidget.h +++ b/src/tools/certificateinfowidget.h @@ -21,6 +21,7 @@ #include #include #include +#include namespace Ui { class CertificateInfoWidget; diff --git a/src/webview/tabwidget.cpp b/src/webview/tabwidget.cpp index c16c373cf..a594b409e 100644 --- a/src/webview/tabwidget.cpp +++ b/src/webview/tabwidget.cpp @@ -284,11 +284,13 @@ int TabWidget::addView(QUrl url, const QString &title, OpenUrlIn openIn, bool se void TabWidget::setTabText(int index, const QString& text) { QString newtext = text; + newtext.remove("&"); // Avoid Alt+? shortcuts if (WebTab* webTab = qobject_cast(p_QupZilla->tabWidget()->widget(index)) ) { if (webTab->isPinned()) newtext = ""; } + QTabWidget::setTabText(index, newtext); } diff --git a/src/webview/tabwidget.h b/src/webview/tabwidget.h index 722d3d45e..28c6d4a99 100644 --- a/src/webview/tabwidget.h +++ b/src/webview/tabwidget.h @@ -18,14 +18,16 @@ #ifndef TABWIDGET_H #define TABWIDGET_H -#include "webview.h" -#include "webtab.h" #include #include #include #include #include #include +#include + +#include "webview.h" +#include "webtab.h" class QupZilla; class WebView;