summaryrefslogtreecommitdiff
path: root/dpi/cookies.c
diff options
context:
space:
mode:
authorcorvid <corvid@lavabit.com>2010-03-22 06:48:21 +0000
committercorvid <corvid@lavabit.com>2010-03-22 06:48:21 +0000
commite86dd0113bb24d5a9e1f584a716342fd5a964937 (patch)
tree4d5b8b340a180dd4a7ab80328f1cffee0f31a3c4 /dpi/cookies.c
parenta6f1d2571b834e855d7aa50c75f522d68e9259e7 (diff)
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.
Diffstat (limited to 'dpi/cookies.c')
-rw-r--r--dpi/cookies.c7
1 files changed, 6 insertions, 1 deletions
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;