From: Guido van Rossum Date: Tue, 9 Dec 1997 20:36:39 +0000 (+0000) Subject: Add explicit check for correct next character in format at end of X-Git-Tag: v1.5b2~39 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=231a41e7085d85591eb5361335a5cc2661c16aa1;p=thirdparty%2FPython%2Fcpython.git Add explicit check for correct next character in format at end of format. This will complain about illegal formats like "O#" instead of ignoring the '#'. --- diff --git a/Python/getargs.c b/Python/getargs.c index f166921cbf12..7931b33cf969 100644 --- a/Python/getargs.c +++ b/Python/getargs.c @@ -256,6 +256,13 @@ vgetargs1(args, format, p_va, compat) return 0; } } + + if (*format != '\0' && !isalpha(*format) && + *format != '|' && *format != ':' && *format != ';') { + PyErr_Format(PyExc_SystemError, + "bad format string: %s", formatsave); + return 0; + } return 1; }