Permalink
Browse files

Limit the path length of a cookie

  • Loading branch information...
1 parent e066a0c commit 0bc2a36b0a550e3658600c6400b8f6849e702b65 Benjamin C Meyer committed Apr 29, 2009
Showing with 5 additions and 0 deletions.
  1. +5 −0 llmozlib2/qtwebkit_cookiejar/src/networkcookiejar.cpp
View
5 llmozlib2/qtwebkit_cookiejar/src/networkcookiejar.cpp
@@ -202,6 +202,8 @@ void NetworkCookieJar::endSession()
}
}
+static const int maxCookiePathLength = 1024;
+
bool NetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList, const QUrl &url)
{
#if defined(NETWORKCOOKIEJAR_DEBUG)
@@ -217,6 +219,9 @@ bool NetworkCookieJar::setCookiesFromUrl(const QList<QNetworkCookie> &cookieList
QString urlPath = d->urlPath(url);
foreach (QNetworkCookie cookie, cookieList) {
+ if (cookie.path().length() > maxCookiePathLength)
+ continue;
+
bool alreadyDead = !cookie.isSessionCookie() && cookie.expirationDate() < now;
if (cookie.path().isEmpty()) {

0 comments on commit 0bc2a36

Please sign in to comment.