aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorcorvid <devnull@localhost>2015-06-28 18:49:55 +0000
committercorvid <devnull@localhost>2015-06-28 18:49:55 +0000
commit5b3daeca8547c7dd7bbcd570fd889edebf065120 (patch)
treee77044d39853a591d81ad08ca3541e4c306bba46 /test
parent10d6b4af3b06e6a03d42f2a284a0212751263fd8 (diff)
cookies be careful with overflow with ridiculously huge Max-Age values
...not that there's any obvious justification for storing cookies for decades.
Diffstat (limited to 'test')
-rw-r--r--test/cookies.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/test/cookies.c b/test/cookies.c
index ff744c97..85031043 100644
--- a/test/cookies.c
+++ b/test/cookies.c
@@ -539,14 +539,33 @@ static void maxage()
a_Cookies_set("name=val; max-age=0", "maxage0.com", "/", NULL);
expect(__LINE__, "", "http", "maxage0.com", "/");
+ a_Cookies_set("name=val; max-age=-0", "maxage-0.com", "/", NULL);
+ expect(__LINE__, "", "http", "maxage-0.com", "/");
+
a_Cookies_set("name=val; max-age=100", "maxage100.com", "/", NULL);
expect(__LINE__, "Cookie: name=val\r\n", "http", "maxage100.com", "/");
a_Cookies_set("name=val; max-age=-100", "maxage-100.com", "/", NULL);
expect(__LINE__, "", "http", "maxage-100.com", "/");
- a_Cookies_set("name=val; max-age=2000000000", "maxage-huge.com", "/", NULL);
- expect(__LINE__, "Cookie: name=val\r\n", "http", "maxage-huge.com", "/");
+ a_Cookies_set("name=val; max-age=2000000000", "maxage2bil.com", "/", NULL);
+ expect(__LINE__, "Cookie: name=val\r\n", "http", "maxage2bil.com", "/");
+
+ a_Cookies_set("name=val; max-age=3000000000", "maxage3bil.com", "/", NULL);
+ expect(__LINE__, "Cookie: name=val\r\n", "http", "maxage3bil.com", "/");
+
+ a_Cookies_set("name=val; max-age=7000000000", "maxage7bil.com", "/", NULL);
+ expect(__LINE__, "Cookie: name=val\r\n", "http", "maxage7bil.com", "/");
+
+ a_Cookies_set("name=val; max-age=-2000000000", "maxage-2bil.com", "/",NULL);
+ expect(__LINE__, "", "http", "maxage-2bil.com", "/");
+
+ a_Cookies_set("name=val; max-age=-3000000000", "maxage-3bil.com", "/",NULL);
+ expect(__LINE__, "", "http", "maxage-3bil.com", "/");
+
+ a_Cookies_set("name=val; max-age=-7000000000", "maxage-7bil.com", "/",NULL);
+ expect(__LINE__, "", "http", "maxage-7bil.com", "/");
+
/* just having a server date shouldn't matter */
a_Cookies_set("name=val; max-age=0", "maxage0s.com", "/", server_date);