diff options
author | Peter Hartmann <peter.hartmann@nokia.com> | 2011-04-19 09:38:06 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@nokia.com> | 2011-04-20 08:19:13 (GMT) |
commit | 7a9ed6a1983e318bfb14f0b2db41b3a4e1415529 (patch) | |
tree | bc6c518d52082cee7c70af6952e5ca3971ec3316 | |
parent | 5888b7d01c05c03bc06a6672a4a8be30bc4192f5 (diff) | |
download | Qt-7a9ed6a1983e318bfb14f0b2db41b3a4e1415529.zip Qt-7a9ed6a1983e318bfb14f0b2db41b3a4e1415529.tar.gz Qt-7a9ed6a1983e318bfb14f0b2db41b3a4e1415529.tar.bz2 |
QNetworkCookie: do not access date string out of bounds
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index c2a6925..52eb345 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -737,7 +737,7 @@ static QDateTime parseDateString(const QByteArray &dateString) // 4 digit Year if (isNum && year == -1 - && dateString.length() >= at + 3) { + && dateString.length() > at + 3) { if (isNumber(dateString[at + 1]) && isNumber(dateString[at + 2]) && isNumber(dateString[at + 3])) { diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp index 91dfe47..e0c477b 100644 --- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp +++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp @@ -707,6 +707,7 @@ void tst_QNetworkCookie::parseMultipleCookies_data() cookie.setDomain("!@#$%^&*();:."); // the ';' is actually problematic, because it is a separator list = QList<QNetworkCookie>(); QTest::newRow("domain-non-alpha-numeric") << "NonAlphNumDomName=NonAlphNumDomValue; domain=!@#$%^&*()" << list; + QTest::newRow("expiration-3digit1") << "a=b; expires=123" << list; // used to ASSERT } void tst_QNetworkCookie::parseMultipleCookies() |