summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorginsbach <ginsbach@NetBSD.org>2016-03-18 12:41:25 +0000
committerginsbach <ginsbach@NetBSD.org>2016-03-18 12:41:25 +0000
commit259f2f01c1aecc6ece36ea4960afe3fb93590c8d (patch)
tree7cf360b821a36cec80ab28de0c1df2b1f0c1f2d1 /lib/libc
parent520c81e4b23f8c2efedc4d2d50a52ddd7f8f5eb3 (diff)
Use the correct upper bounds for the types array. The correct upper
bound is typecnt not timecnt. Now perpetual 'standard' time zones will work correctly as they have a typecnt of 1 but a timecnt of 0.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/time/localtime.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/libc/time/localtime.c b/lib/libc/time/localtime.c
index 7537d5cbc38..c1e0a7c3817 100644
--- a/lib/libc/time/localtime.c
+++ b/lib/libc/time/localtime.c
@@ -1,4 +1,4 @@
-/* $NetBSD: localtime.c,v 1.102 2016/03/15 15:16:01 christos Exp $ */
+/* $NetBSD: localtime.c,v 1.103 2016/03/18 12:41:25 ginsbach Exp $ */
/*
** This file is in the public domain, so clarified as of
@@ -10,7 +10,7 @@
#if 0
static char elsieid[] = "@(#)localtime.c 8.17";
#else
-__RCSID("$NetBSD: localtime.c,v 1.102 2016/03/15 15:16:01 christos Exp $");
+__RCSID("$NetBSD: localtime.c,v 1.103 2016/03/18 12:41:25 ginsbach Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -282,7 +282,7 @@ const char *
tzgetname(const timezone_t sp, int isdst)
{
int i;
- for (i = 0; i < sp->timecnt; ++i) {
+ for (i = 0; i < sp->typecnt; ++i) {
const struct ttinfo *const ttisp = &sp->ttis[sp->types[i]];
if (ttisp->tt_isdst == isdst)
@@ -297,7 +297,7 @@ tzgetgmtoff(const timezone_t sp, int isdst)
{
int i;
long l = -1;
- for (i = 0; i < sp->timecnt; ++i) {
+ for (i = 0; i < sp->typecnt; ++i) {
const struct ttinfo *const ttisp = &sp->ttis[sp->types[i]];
if (ttisp->tt_isdst == isdst) {