summaryrefslogtreecommitdiff
path: root/sbin/unwind
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2024-04-28 16:43:44 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2024-04-28 16:43:44 +0000
commit42025f92ff4da26a97019d8b98eb0d9143a88724 (patch)
tree71bdb58759883b4566b5dbbfce52b62ca2800fd8 /sbin/unwind
parent09dd1ad3e6ca879f5fd074c8e48b533da6752986 (diff)
gmtime(3) / locatime(3) can fail when timestamps are way off.
Add missing error checks to all calls under sbin/ Input & OK millert
Diffstat (limited to 'sbin/unwind')
-rw-r--r--sbin/unwind/libunbound/util/log.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sbin/unwind/libunbound/util/log.c b/sbin/unwind/libunbound/util/log.c
index a15ee920c0f..86a3acee43c 100644
--- a/sbin/unwind/libunbound/util/log.c
+++ b/sbin/unwind/libunbound/util/log.c
@@ -271,8 +271,8 @@ log_vmsg(int pri, const char* type,
}
now = (time_t)time(NULL);
#if defined(HAVE_STRFTIME) && defined(HAVE_LOCALTIME_R)
- if(log_time_asc && strftime(tmbuf, sizeof(tmbuf), "%b %d %H:%M:%S",
- localtime_r(&now, &tm))%(sizeof(tmbuf)) != 0) {
+ if(log_time_asc && localtime_r(&now, &tm) && strftime(tmbuf,
+ sizeof(tmbuf), "%b %d %H:%M:%S", &tm)%(sizeof(tmbuf)) != 0) {
/* %sizeof buf!=0 because old strftime returned max on error */
fprintf(logfile, "%s %s[%d:%x] %s: %s\n", tmbuf,
ident, (int)getpid(), tid?*tid:0, type, message);