From e86dd0113bb24d5a9e1f584a716342fd5a964937 Mon Sep 17 00:00:00 2001 From: corvid Date: Mon, 22 Mar 2010 06:48:21 +0000 Subject: fix reading maximum expiration date from cookies.txt I did check that tm.tm_sec was 0 before adding the max time to it, so that wasn't the problem. (max - 1000) was fine... Surely safer in general to do like this anyway, so I didn't spend time really digging into details this time. --- dpi/cookies.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'dpi') diff --git a/dpi/cookies.c b/dpi/cookies.c index 585b8eae..7eac107f 100644 --- a/dpi/cookies.c +++ b/dpi/cookies.c @@ -291,9 +291,14 @@ static void Cookies_load_cookies(FILE *stream) cookie->secure = TRUE; piece = dStrsep(&line_marker, "\t"); if (piece != NULL) { + /* There is some problem with simply putting the maximum value + * into tm.tm_sec (although a value close to it works). + */ + long seconds = strtol(piece, NULL, 10); struct tm tm; Cookies_tm_init(&tm); - tm.tm_sec += strtol(piece, NULL, 10); + tm.tm_min += seconds / 60; + tm.tm_sec += seconds % 60; cookie->expires_at = mktime(&tm); } else { cookie->expires_at = (time_t) -1; -- cgit v1.2.3