diff options
author | kristerw <kristerw@NetBSD.org> | 1999-04-25 19:08:34 +0000 |
---|---|---|
committer | kristerw <kristerw@NetBSD.org> | 1999-04-25 19:08:34 +0000 |
commit | 8da3d5189a9a79e6cd764ad062df763e1cb5a962 (patch) | |
tree | a4f18a35eabd3aba242acb250078087465c895fd /hack/hack.unix.c | |
parent | f58171ad791b7a55a107fe26882b725e3d95616f (diff) | |
download | bsdgames-darwin-8da3d5189a9a79e6cd764ad062df763e1cb5a962.tar.gz bsdgames-darwin-8da3d5189a9a79e6cd764ad062df763e1cb5a962.tar.zst bsdgames-darwin-8da3d5189a9a79e6cd764ad062df763e1cb5a962.zip |
Fix Y2K buffer overflow (from OpenBSD).
Diffstat (limited to 'hack/hack.unix.c')
-rw-r--r-- | hack/hack.unix.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/hack/hack.unix.c b/hack/hack.unix.c index 0160c463..d640138d 100644 --- a/hack/hack.unix.c +++ b/hack/hack.unix.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.unix.c,v 1.5 1997/10/19 16:59:21 christos Exp $ */ +/* $NetBSD: hack.unix.c,v 1.6 1999/04/25 19:08:34 kristerw Exp $ */ /* * Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. @@ -6,7 +6,7 @@ #include <sys/cdefs.h> #ifndef lint -__RCSID("$NetBSD: hack.unix.c,v 1.5 1997/10/19 16:59:21 christos Exp $"); +__RCSID("$NetBSD: hack.unix.c,v 1.6 1999/04/25 19:08:34 kristerw Exp $"); #endif /* not lint */ /* This file collects some Unix dependencies; hack.pager.c contains some more */ @@ -64,12 +64,8 @@ getdate() static char datestr[7]; struct tm *lt = getlt(); - (void) sprintf(datestr, "%2d%2d%2d", - lt->tm_year, lt->tm_mon + 1, lt->tm_mday); - if (datestr[2] == ' ') - datestr[2] = '0'; - if (datestr[4] == ' ') - datestr[4] = '0'; + (void) sprintf(datestr, "%02d%02d%02d", + lt->tm_year % 100, lt->tm_mon + 1, lt->tm_mday); return (datestr); } |