summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libc/time/zdump.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libc/time/zdump.c b/lib/libc/time/zdump.c
index 0f034b74d98..e0f76d13fac 100644
--- a/lib/libc/time/zdump.c
+++ b/lib/libc/time/zdump.c
@@ -1,5 +1,5 @@
#if defined(LIBC_SCCS) && !defined(lint)
-static char rcsid[] = "$OpenBSD: zdump.c,v 1.2 1996/08/19 08:34:55 tholo Exp $";
+static char rcsid[] = "$OpenBSD: zdump.c,v 1.3 1996/08/27 03:36:57 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
/*
@@ -189,7 +189,8 @@ char * argv[];
t += SECSPERHOUR * HOURSPERDAY;
show(argv[i], t, TRUE);
tm = *localtime(&t);
- (void) strncpy(buf, abbr(&tm), (sizeof buf) - 1);
+ (void) strncpy(buf, abbr(&tm), sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
for ( ; ; ) {
if (cutoff != NULL && t >= cuttime)
break;
@@ -205,7 +206,8 @@ char * argv[];
newt = hunt(argv[i], t, newt);
newtm = *localtime(&newt);
(void) strncpy(buf, abbr(&newtm),
- (sizeof buf) - 1);
+ sizeof(buf) - 1);
+ buf[sizeof(buf) - 1] = '\0';
}
t = newt;
tm = newtm;
@@ -246,7 +248,8 @@ time_t hit;
static char loab[MAX_STRING_LENGTH];
lotm = *localtime(&lot);
- (void) strncpy(loab, abbr(&lotm), (sizeof loab) - 1);
+ (void) strncpy(loab, abbr(&lotm), sizeof(loab) - 1);
+ loab[sizeof(loab) - 1] = '\0';
while ((hit - lot) >= 2) {
t = lot / 2 + hit / 2;
if (t <= lot)