[dovecot-cvs] dovecot: printf_string_fix_format() now panics if %n modifier is...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 11 01:01:00 EEST 2007


details:   http://hg.dovecot.org/dovecot/rev/922607d52fba
changeset: 5677:922607d52fba
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 11 01:00:07 2007 +0300
description:
printf_string_fix_format() now panics if %n modifier is found.

diffstat:

1 file changed, 10 insertions(+), 2 deletions(-)
src/lib/strfuncs.c |   12 ++++++++++--

diffs (22 lines):

diff -r 698da4fededa -r 922607d52fba src/lib/strfuncs.c
--- a/src/lib/strfuncs.c	Sun Jun 10 22:54:47 2007 +0300
+++ b/src/lib/strfuncs.c	Mon Jun 11 01:00:07 2007 +0300
@@ -62,8 +62,16 @@ const char *printf_string_fix_format(con
 	const char *p;
 
 	for (p = fmt; *p != '\0'; p++) {
-		if (*p == '%' && p[1] == 'm')
-			return fix_format_real(fmt, p);
+		if (*p++ == '%') {
+			switch (*p) {
+			case 'n':
+				i_panic("%%n modifier used");
+			case 'm':
+				return fix_format_real(fmt, p-1);
+			case '\0':
+				i_panic("%% modifier missing");
+			}
+		}
 	}
 
 	return fmt;


More information about the dovecot-cvs mailing list