aboutsummaryrefslogtreecommitdiff
path: root/lib/cookie.h
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2017-09-18 00:55:07 +0200
committerDaniel Stenberg <daniel@haxx.se>2017-09-18 22:55:50 +0200
commit2bc230de63bd7da197280a69d84972b61455cd18 (patch)
treeb616832f6cd1138851d1ed87ba68fb60e0a5c85f /lib/cookie.h
parent1a072796d390a7f56739d48a5158c250e211e2f7 (diff)
cookies: reject oversized cookies
... instead of truncating them. There's no fixed limit for acceptable cookie names in RFC 6265, but the entire cookie is said to be less than 4096 bytes (section 6.1). This is also what browsers seem to implement. We now allow max 5000 bytes cookie header. Max 4095 bytes length per cookie name and value. Name + value together may not exceed 4096 bytes. Added test 1151 to verify Bug: https://curl.haxx.se/mail/lib-2017-09/0062.html Reported-by: Kevin Smith Closes #1894
Diffstat (limited to 'lib/cookie.h')
-rw-r--r--lib/cookie.h11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/cookie.h b/lib/cookie.h
index a9a45785c..cb50b71c6 100644
--- a/lib/cookie.h
+++ b/lib/cookie.h
@@ -7,7 +7,7 @@
* | (__| |_| | _ <| |___
* \___|\___/|_| \_\_____|
*
- * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
@@ -62,13 +62,16 @@ struct CookieInfo {
that comprise the cookie non-terminal in the syntax description of the
Set-Cookie header)"
+ We allow max 5000 bytes cookie header. Max 4095 bytes length per cookie
+ name and value. Name + value may not exceed 4096 bytes.
+
*/
#define MAX_COOKIE_LINE 5000
#define MAX_COOKIE_LINE_TXT "4999"
-/* This is the maximum length of a cookie name we deal with: */
-#define MAX_NAME 1024
-#define MAX_NAME_TXT "1023"
+/* This is the maximum length of a cookie name or content we deal with: */
+#define MAX_NAME 4096
+#define MAX_NAME_TXT "4095"
struct Curl_easy;
/*