From: Nigel Metheringham <nigel@exim.org> Date: Fri, 12 Dec 2008 14:36:37 +0000 (+0000) Subject: Buffer overrun fix. fixes: bug #787 X-Git-Tag: DEVEL_PDKIM_START~13 X-Git-Url: http://git.exim.org/exim.git/commitdiff_plain/24c929a27415c7cfc7126c47e4cad39acf3efa6b Buffer overrun fix. fixes: bug #787 --- diff --git a/src/src/string.c b/src/src/string.c index 20bd1d1..8345529 100644 --- a/src/src/string.c +++ b/src/src/string.c @@ -1267,10 +1267,17 @@ while (*fp != 0) not OK, add part of the string (debugging uses this to show as much as possible). */ + if (p == last) + { + yield = FALSE; + goto END_FORMAT; + } if (p >= last - width) { yield = FALSE; width = precision = last - p - 1; + if (width < 0) width = 0; + if (precision < 0) precision = 0; } sprintf(CS p, "%*.*s", width, precision, s); if (fp[-1] == 'S')