diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-02-18 09:48:08 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2024-02-18 09:51:49 +0000 |
commit | 1365bb722af1365baee6ea1e3d44917533908d53 (patch) | |
tree | 9b339b3371c9f1a8e29cfc4645f4880b84982635 /contrib/tzcode | |
parent | 078a31136c8ce89c23c0fae0b24f98c0bd4d45e6 (diff) | |
download | src-1365bb722af1365baee6ea1e3d44917533908d53.tar.gz src-1365bb722af1365baee6ea1e3d44917533908d53.zip |
tzcode: Fix overflow handling in TZ parser.
Obtained from: upstream 9fc11a27
MFC after: 1 week
PR: 276281
Diffstat (limited to 'contrib/tzcode')
-rw-r--r-- | contrib/tzcode/localtime.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/tzcode/localtime.c b/contrib/tzcode/localtime.c index 2b33cce1ec50..25a65385256b 100644 --- a/contrib/tzcode/localtime.c +++ b/contrib/tzcode/localtime.c @@ -1246,11 +1246,13 @@ tzparse(const char *name, struct state *sp, struct state const *basep) do { int_fast32_t yearsecs = year_lengths[isleap(yearbeg - 1)] * SECSPERDAY; + time_t janfirst1 = janfirst; yearbeg--; - if (increment_overflow_time(&janfirst, -yearsecs)) { + if (increment_overflow_time(&janfirst1, -yearsecs)) { janoffset = -yearsecs; break; } + janfirst = janfirst1; } while (atlo < janfirst && EPOCH_YEAR - YEARSPERREPEAT / 2 < yearbeg); |