From c21727c0c4c6e49a5196a270a9a4bc961fcb679e Mon Sep 17 00:00:00 2001 From: schwarze Date: Mon, 15 Dec 2014 17:29:58 +0000 Subject: [PATCH] Catch localtime() failure for additional safety; patch from Jan Stary some time ago. --- usr.bin/mandoc/mandoc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/usr.bin/mandoc/mandoc.c b/usr.bin/mandoc/mandoc.c index 45793f1752c..16c4f026ee5 100644 --- a/usr.bin/mandoc/mandoc.c +++ b/usr.bin/mandoc/mandoc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mandoc.c,v 1.56 2014/11/28 19:25:03 schwarze Exp $ */ +/* $OpenBSD: mandoc.c,v 1.57 2014/12/15 17:29:58 schwarze Exp $ */ /* * Copyright (c) 2008, 2009, 2010, 2011 Kristaps Dzonsons * Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze @@ -475,6 +475,8 @@ time2a(time_t t) int isz; tm = localtime(&t); + if (tm == NULL) + return(NULL); /* * Reserve space: -- 2.20.1