[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Static analyzer "smatch" found potential bug in format.c
From: |
Carlo Teubner |
Subject: |
Static analyzer "smatch" found potential bug in format.c |
Date: |
Fri, 27 Aug 2010 23:57:59 +0100 |
Just for fun, I ran smatch (http://smatch.sourceforge.net/) on the m4
code. The only legitimate issue it found is fixed by this patch:
diff --git a/modules/format.c b/modules/format.c
index b772290..2787154 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 (c >= sizeof ok || !ok[c] || !f_len)
{
m4_warn (context, 0, me, _("unrecognized specifier in %s"),
quotearg_style_mem (locale_quoting_style, f, M4ARGLEN (1)));
If haven't tested it but it seems fairly clear to me.
This issue exists both in latest git version (to which this patch
applies) and 1.4.14.
Cheers,
Carlo
- Static analyzer "smatch" found potential bug in format.c,
Carlo Teubner <=