diff options
author | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-06-11 02:19:14 +0000 |
---|---|---|
committer | Tobias Stoeckmann <tobias@cvs.openbsd.org> | 2008-06-11 02:19:14 +0000 |
commit | 5739b8928a4f63a5b2481383b7afc7076973606d (patch) | |
tree | 0dc7c9ed718b93ea7a822edcdb2dbf56c1f0fb27 /usr.bin/cvs/status.c | |
parent | 2d78e6e42241150fbd1fb65ecc37b5fab793e8b6 (diff) |
Avoid possible NULL pointer dereferences by using reentrant versions
of time functions.
ok joris
Diffstat (limited to 'usr.bin/cvs/status.c')
-rw-r--r-- | usr.bin/cvs/status.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/usr.bin/cvs/status.c b/usr.bin/cvs/status.c index 7e1b86f294f..70e88240396 100644 --- a/usr.bin/cvs/status.c +++ b/usr.bin/cvs/status.c @@ -1,4 +1,4 @@ -/* $OpenBSD: status.c,v 1.86 2008/06/08 18:07:44 joris Exp $ */ +/* $OpenBSD: status.c,v 1.87 2008/06/11 02:19:13 tobias Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2005-2008 Xavier Santolaria <xsa@openbsd.org> @@ -17,6 +17,7 @@ */ #include <string.h> +#include <time.h> #include <unistd.h> #include "cvs.h" @@ -212,12 +213,12 @@ cvs_status_local(struct cvs_file *cf) cvs_printf(" Sticky Tag:\t\t(none)\n"); if (cf->file_ent->ce_date != -1) { - struct tm *datetm; + struct tm datetm; char datetmp[CVS_TIME_BUFSZ]; - datetm = gmtime(&(cf->file_ent->ce_date)); + gmtime_r(&(cf->file_ent->ce_date), &datetm); (void)strftime(datetmp, sizeof(datetmp), - CVS_DATE_FMT, datetm); + CVS_DATE_FMT, &datetm); cvs_printf(" Sticky Date:\t\t%s\n", datetmp); } else if (verbosity > 0) |