aboutsummaryrefslogtreecommitdiff
path: root/contrib/tzcode
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2024-02-18 09:48:08 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2024-02-18 09:51:49 +0000
commit1365bb722af1365baee6ea1e3d44917533908d53 (patch)
tree9b339b3371c9f1a8e29cfc4645f4880b84982635 /contrib/tzcode
parent078a31136c8ce89c23c0fae0b24f98c0bd4d45e6 (diff)
downloadsrc-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.c4
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);