Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/crypto/dist handle ctime returning NULL.
details: https://anonhg.NetBSD.org/src/rev/cca93a5c325a
branches: trunk
changeset: 753569:cca93a5c325a
user: christos <christos%NetBSD.org@localhost>
date: Fri Apr 02 15:13:26 2010 +0000
description:
handle ctime returning NULL.
diffstat:
crypto/dist/heimdal/appl/ftp/ftpd/kauth.c | 7 ++++---
crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c | 8 +++++---
crypto/dist/ipsec-tools/src/racoon/backupsa.c | 7 ++++---
3 files changed, 13 insertions(+), 9 deletions(-)
diffs (74 lines):
diff -r 160709202325 -r cca93a5c325a crypto/dist/heimdal/appl/ftp/ftpd/kauth.c
--- a/crypto/dist/heimdal/appl/ftp/ftpd/kauth.c Fri Apr 02 15:09:12 2010 +0000
+++ b/crypto/dist/heimdal/appl/ftp/ftpd/kauth.c Fri Apr 02 15:13:26 2010 +0000
@@ -34,7 +34,7 @@
#include "ftpd_locl.h"
__RCSID("$Heimdal: kauth.c 15666 2005-07-19 17:08:11Z lha $"
- "$NetBSD: kauth.c,v 1.2 2008/03/22 08:36:50 mlelstv Exp $");
+ "$NetBSD: kauth.c,v 1.3 2010/04/02 15:17:52 christos Exp $");
#if defined(KRB4) || defined(KRB5)
@@ -238,8 +238,9 @@
char *cp;
time_t t = (time_t)dp;
- if (t == (time_t)(-1L)) return "*** Never *** ";
- cp = ctime(&t) + 4;
+ if (t == (time_t)(-1L) || (cp = ctime(&t)) == NULL)
+ return "*** Never *** ";
+ cp += 4;
cp[15] = '\0';
return (cp);
}
diff -r 160709202325 -r cca93a5c325a crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c
--- a/crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c Fri Apr 02 15:09:12 2010 +0000
+++ b/crypto/dist/ipsec-tools/src/libipsec/pfkey_dump.c Fri Apr 02 15:13:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pfkey_dump.c,v 1.16 2007/07/18 12:07:50 vanhu Exp $ */
+/* $NetBSD: pfkey_dump.c,v 1.17 2010/04/02 15:13:26 christos Exp $ */
/* $KAME: pfkey_dump.c,v 1.45 2003/09/08 10:14:56 itojun Exp $ */
@@ -774,8 +774,10 @@
for (;i < 20;) buf[i++] = ' ';
} else {
char *t0;
- t0 = ctime(&t);
- memcpy(buf, t0 + 4, 20);
+ if ((t0 = ctime(&t)) == NULL)
+ memset(buf, '?', 20);
+ else
+ memcpy(buf, t0 + 4, 20);
}
buf[20] = '\0';
diff -r 160709202325 -r cca93a5c325a crypto/dist/ipsec-tools/src/racoon/backupsa.c
--- a/crypto/dist/ipsec-tools/src/racoon/backupsa.c Fri Apr 02 15:09:12 2010 +0000
+++ b/crypto/dist/ipsec-tools/src/racoon/backupsa.c Fri Apr 02 15:13:26 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: backupsa.c,v 1.9 2007/07/18 12:07:51 vanhu Exp $ */
+/* $NetBSD: backupsa.c,v 1.10 2010/04/02 15:15:00 christos Exp $ */
/* $KAME: backupsa.c,v 1.16 2001/12/31 20:13:40 thorpej Exp $ */
@@ -452,7 +452,7 @@
struct tm tm;
time_t t;
char *buf = "Nov 24 18:22:48 1986 ";
- char *p;
+ const char *p;
memset(&tm, 0, sizeof(tm));
p = str2tmx(buf, &tm);
@@ -460,7 +460,8 @@
t = mktime(&tm);
if (t == -1)
printf("mktime failed.");
- p = ctime(&t);
+ if ((p = ctime(&t)) == NULL)
+ p = "?";
printf("[%s]\n", p);
exit(0);
Home |
Main Index |
Thread Index |
Old Index