changeset 1631:ec05ef8ca40c

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.
author corvid <corvid@lavabit.com>
date Mon, 22 Mar 2010 06:48:21 +0000
parents 00e22d98bce8
children d76eddb72e6d
files dpi/cookies.c
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dpi/cookies.c	Mon Mar 22 01:11:39 2010 +0000
+++ b/dpi/cookies.c	Mon Mar 22 06:48:21 2010 +0000
@@ -291,9 +291,14 @@
             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;