From 95d7405a7540f91f67a505fa6458bde3d8e31f79 Mon Sep 17 00:00:00 2001 From: Carlo Teubner Date: Sat, 28 Aug 2010 16:19:16 -0600 Subject: m4: avoid a crash with bad format string. * src/format.c (expand_format): Fix off-by-one error. * THANKS: Add Carlo Teubner. Copyright-paperwork-exempt: Yes Signed-off-by: Eric Blake --- THANKS | 1 + modules/format.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/THANKS b/THANKS index e071bab9..62c1b748 100644 --- a/THANKS +++ b/THANKS @@ -30,6 +30,7 @@ Brendan Kehoe brendan@cygnus.com Brian J. Fox bfox@datawave.net Brian D. Carlstrom bdc@clark.lcs.mit.edu Bruno Haible bruno@clisp.org +Carlo Teubner carlo.teubner@gmail.com Cesar Strauss cestrauss@gmail.com Charles Wilson cygwin@cwilson.fastmail.fm Chris McGuire chris@wso.net diff --git a/modules/format.c b/modules/format.c index b772290a..b13b2630 100644 --- a/modules/format.c +++ b/modules/format.c @@ -333,7 +333,7 @@ format (m4 *context, m4_obstack *obs, int argc, m4_macro_args *argv) } c = *fmt; - if (c > sizeof ok || !ok[c] || !f_len) + if (sizeof ok <= c || !ok[c] || !f_len) { m4_warn (context, 0, me, _("unrecognized specifier in %s"), quotearg_style_mem (locale_quoting_style, f, M4ARGLEN (1))); -- cgit v1.2.1