aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--builtin.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 104eacd5..a98401ce 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2011-10-18 Arnold D. Robbins <arnold@skeeve.com>
+
+ * builtin.c (do_strftime): Add check for negative / overflowed
+ time_t value with fatal error. Thanks to Hermann Peifer
+ <peifer@gmx.eu> for the bug report.
+
2011-10-10 Arnold D. Robbins <arnold@skeeve.com>
* 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);
}