From 4a9f65ea0a861f842fa05120f9da0365019c2892 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Tue, 18 Oct 2011 12:16:53 +0200 Subject: Fix stftime. --- ChangeLog | 6 ++++++ builtin.c | 2 ++ 2 files changed, 8 insertions(+) diff --git a/ChangeLog b/ChangeLog index 104eacd5..a98401ce 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2011-10-18 Arnold D. Robbins + + * builtin.c (do_strftime): Add check for negative / overflowed + time_t value with fatal error. Thanks to Hermann Peifer + for the bug report. + 2011-10-10 Arnold D. Robbins * builtin.c (do_sub): Init textlen to zero to avoid "may be diff --git a/builtin.c b/builtin.c index 072fd8ff..bae02f4d 100644 --- a/builtin.c +++ b/builtin.c @@ -1673,6 +1673,8 @@ do_strftime(int nargs) if (do_lint && (t2->flags & (NUMCUR|NUMBER)) == 0) lintwarn(_("strftime: received non-numeric second argument")); fclock = (time_t) force_number(t2); + if (fclock < 0) + fatal(_("strftime: second argument less than 0 or too big for time_t")); DEREF(t2); } -- cgit v1.2.3