From 231a41e7085d85591eb5361335a5cc2661c16aa1 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 9 Dec 1997 20:36:39 +0000 Subject: [PATCH] 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 '#'. --- Python/getargs.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Python/getargs.c b/Python/getargs.c index f166921cbf..7931b33cf9 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; } -- 2.50.1