diff options
author | Nick Mathewson <nickm@torproject.org> | 2012-09-11 10:41:59 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2012-09-11 13:13:07 -0400 |
commit | 973c18bf0e84d14d8006a9ae97fde7f7fb97e404 (patch) | |
tree | 4f8172e13883e45ecff9295737cc82e20dac3602 /src/or | |
parent | 1c30e6abc93fa086a14d01d838066581a3657285 (diff) | |
download | tor-973c18bf0e84d14d8006a9ae97fde7f7fb97e404.tar.gz tor-973c18bf0e84d14d8006a9ae97fde7f7fb97e404.zip |
Fix assertion failure in tor_timegm.
Fixes bug 6811.
Diffstat (limited to 'src/or')
-rw-r--r-- | src/or/directory.c | 3 | ||||
-rw-r--r-- | src/or/dirvote.c | 6 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/or/directory.c b/src/or/directory.c index 29cf10cea0..975f8910cd 100644 --- a/src/or/directory.c +++ b/src/or/directory.c @@ -2493,7 +2493,8 @@ directory_handle_command_get(dir_connection_t *conn, const char *headers, if ((header = http_get_header(headers, "If-Modified-Since: "))) { struct tm tm; if (parse_http_time(header, &tm) == 0) { - if_modified_since = tor_timegm(&tm); + if (tor_timegm(&tm, &if_modified_since)<0) + if_modified_since = 0; } /* The correct behavior on a malformed If-Modified-Since header is to * act as if no If-Modified-Since header had been given. */ diff --git a/src/or/dirvote.c b/src/or/dirvote.c index ab08fd0200..a557fc782e 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -2536,7 +2536,7 @@ time_t dirvote_get_start_of_next_interval(time_t now, int interval) { struct tm tm; - time_t midnight_today; + time_t midnight_today=0; time_t midnight_tomorrow; time_t next; @@ -2545,7 +2545,9 @@ dirvote_get_start_of_next_interval(time_t now, int interval) tm.tm_min = 0; tm.tm_sec = 0; - midnight_today = tor_timegm(&tm); + if (tor_timegm(&tm, &midnight_today) < 0) { + log_warn(LD_BUG, "Ran into an invalid time when trying to find midnight."); + } midnight_tomorrow = midnight_today + (24*60*60); next = midnight_today + ((now-midnight_today)/interval + 1)*interval; |