diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-05-12 15:33:56 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-05-12 15:33:56 -0400 |
commit | 7bc9d1e00204c5f11ccf81a9eeca3efaead63cc9 (patch) | |
tree | f9e412ee16e8f97792fc009bf466669312c28c17 | |
parent | 44cbd00dfaba8314dea274d5c4535adc3c202220 (diff) | |
parent | e8cc9f3edf21ff56ba16cf716e74eb1efba0b0f1 (diff) | |
download | tor-7bc9d1e00204c5f11ccf81a9eeca3efaead63cc9.tar.gz tor-7bc9d1e00204c5f11ccf81a9eeca3efaead63cc9.zip |
Merge branch 'maint-0.2.8'
-rw-r--r-- | changes/bug18977 | 4 | ||||
-rw-r--r-- | src/common/compat.c | 4 | ||||
-rw-r--r-- | src/common/util.c | 2 |
3 files changed, 10 insertions, 0 deletions
diff --git a/changes/bug18977 b/changes/bug18977 new file mode 100644 index 0000000000..3f46b09fba --- /dev/null +++ b/changes/bug18977 @@ -0,0 +1,4 @@ + o Minor bugfixes (time handling): + - When correcting a corrupt 'struct tm' value, fill in the tm_wday + field. Otherwise, our unit tests crash on Windows. + Fixes bug 18977; bugfix on 0.2.2.25-alpha. diff --git a/src/common/compat.c b/src/common/compat.c index af61f024ef..23eaa134cf 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -2923,6 +2923,7 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf, r->tm_mon = 11; r->tm_mday = 31; r->tm_yday = 364; + r->tm_wday = 6; r->tm_hour = 23; r->tm_min = 59; r->tm_sec = 59; @@ -2931,6 +2932,7 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf, r->tm_mon = 0; r->tm_mday = 1; r->tm_yday = 0; + r->tm_wday = 0; r->tm_hour = 0; r->tm_min = 0; r->tm_sec = 0; @@ -2948,6 +2950,7 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf, r->tm_mon = 0; r->tm_mday = 1; r->tm_yday = 0; + r->tm_wday = 0; r->tm_hour = 0; r->tm_min = 0 ; r->tm_sec = 0; @@ -2961,6 +2964,7 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf, r->tm_mon = 11; r->tm_mday = 31; r->tm_yday = 364; + r->tm_wday = 6; r->tm_hour = 23; r->tm_min = 59; r->tm_sec = 59; diff --git a/src/common/util.c b/src/common/util.c index d1c8b2ee4c..14deb4e37d 100644 --- a/src/common/util.c +++ b/src/common/util.c @@ -1706,6 +1706,7 @@ parse_iso_time_(const char *cp, time_t *t, int strict) st_tm.tm_hour = hour; st_tm.tm_min = minute; st_tm.tm_sec = second; + st_tm.tm_wday = 0; /* Should be ignored. */ if (st_tm.tm_year < 70) { char *esc = esc_for_log(cp); @@ -1773,6 +1774,7 @@ parse_http_time(const char *date, struct tm *tm) tm->tm_hour = (int)tm_hour; tm->tm_min = (int)tm_min; tm->tm_sec = (int)tm_sec; + tm->tm_wday = 0; /* Leave this unset. */ month[3] = '\0'; /* Okay, now decode the month. */ |