summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-12-09 20:36:39 (GMT)
committerGuido van Rossum <guido@python.org>1997-12-09 20:36:39 (GMT)
commit231a41e7085d85591eb5361335a5cc2661c16aa1 (patch)
treee580b3aa89004888cb3c02f66bbeabaac5b08794 /Python
parenteefcba61f433a2cc7c993bcd3daecfd9bf9d081f (diff)
downloadcpython-231a41e7085d85591eb5361335a5cc2661c16aa1.zip
cpython-231a41e7085d85591eb5361335a5cc2661c16aa1.tar.gz
cpython-231a41e7085d85591eb5361335a5cc2661c16aa1.tar.bz2
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 '#'.
Diffstat (limited to 'Python')
-rw-r--r--Python/getargs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index f166921..7931b33 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;
}