diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-03-26 14:48:18 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@trolltech.com> | 2009-03-30 15:44:23 (GMT) |
commit | 9cc1b5573affdfcf1862369afe387c8fdf8474e6 (patch) | |
tree | b6788aa9f487bcf57d2ac4e13bda17ffd55288d9 /src/network/access | |
parent | fde8457213eaa3da881d1afa8f9f2294acdc4877 (diff) | |
download | Qt-9cc1b5573affdfcf1862369afe387c8fdf8474e6.zip Qt-9cc1b5573affdfcf1862369afe387c8fdf8474e6.tar.gz Qt-9cc1b5573affdfcf1862369afe387c8fdf8474e6.tar.bz2 |
Fix accesses past-the-end of the byte array
Signed-off-by: Peter Hartmann <peter.hartmann@trolltech.com>
Diffstat (limited to 'src/network/access')
-rw-r--r-- | src/network/access/qnetworkcookie.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/access/qnetworkcookie.cpp b/src/network/access/qnetworkcookie.cpp index 286c5f6..4846618 100644 --- a/src/network/access/qnetworkcookie.cpp +++ b/src/network/access/qnetworkcookie.cpp @@ -662,7 +662,8 @@ static QDateTime parseDateString(const QByteArray &dateString) || (dateString[at - 1] == 't'))) { int end = 1; - while (end < 5 && dateString[at + end] >= '0' && dateString[at + end] <= '9') + while (end < 5 && dateString.length() > at+end + && dateString[at + end] >= '0' && dateString[at + end] <= '9') ++end; int minutes = 0; int hours = 0; @@ -736,7 +737,7 @@ static QDateTime parseDateString(const QByteArray &dateString) // Could be month, day or year if (isNum) { int length = 1; - if (dateString.length() >= at + 1 + if (dateString.length() > at + 1 && isNumber(dateString[at + 1])) ++length; int x = atoi(dateString.mid(at, length).constData()); |