From 5ca3ef321b2a9328cab37481ebcbdd80c0789e15 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Wed, 20 Feb 2008 17:02:06 -0700 Subject: [PATCH] Fix out-of-bounds read for sanitized macro names, from 2008-02-06. * src/m4.c (m4_verror_at_line): Properly terminate the string. Reported by Ralf Wildenhues. Signed-off-by: Eric Blake --- ChangeLog | 6 ++++++ src/m4.c | 1 + 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index 62b78a90..0f4e4963 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2008-02-21 Eric Blake + + Fix out-of-bounds read for sanitized macro names, from 2008-02-06. + * src/m4.c (m4_verror_at_line): Properly terminate the string. + Reported by Ralf Wildenhues. + 2008-02-19 Eric Blake Clean up foreach example. diff --git a/src/m4.c b/src/m4.c index a6bc92ad..af4991f9 100644 --- a/src/m4.c +++ b/src/m4.c @@ -113,6 +113,7 @@ m4_verror_at_line (bool warn, int status, int errnum, const char *file, *p++ = *macro++; } while (*macro); + *p = '\0'; } /* Prepend warning and the macro name, as needed. But if that fails for non-memory reasons (unlikely), then still use the original -- 2.11.4.GIT