summaryrefslogtreecommitdiffstats
path: root/src/corelib
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2012-07-31 13:10:54 +0200
committerQt by Nokia <qt-info@nokia.com>2012-08-01 13:04:12 +0200
commit4d1f0ccbf31c7aed9629e6b9e9bdd6b903119b11 (patch)
tree6d6e0d77e69397d8801370861205d14893df39f6 /src/corelib
parent44a7330d675ce6b7eebb35060bb02d63d608fc65 (diff)
Fix handling of encoded NULs (%00) in QUrl::fromPercentEncoding
QString::fromUtf8, without an explicit size, (currently) defaults to stopping at the first NUL. That means we need to pass an explicit size. Also take the opportunity to test that QUrl::toPercentEncoding also works with the same data. Change-Id: I79362d67afda624b01ca07b0315b611c4aa3fdda Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: David Faure <faure@kde.org>
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/io/qurl.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 4897e5b07c..b009073848 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -2516,7 +2516,8 @@ QUrl QUrl::fromEncoded(const QByteArray &input, ParsingMode mode)
*/
QString QUrl::fromPercentEncoding(const QByteArray &input)
{
- return QString::fromUtf8(QByteArray::fromPercentEncoding(input));
+ QByteArray ba = QByteArray::fromPercentEncoding(input);
+ return QString::fromUtf8(ba, ba.size());
}
/*!