diff Python/getargs.c @ 6805:93e480dedcf0 legacy-trunk

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 '#'.
author Guido van Rossum <guido@python.org>
date Tue, 09 Dec 1997 20:36:39 +0000
parents 3b2fda31bf1b
children 74ad26825060
line wrap: on
line diff
--- a/Python/getargs.c	Tue Dec 09 19:47:24 1997 +0000
+++ b/Python/getargs.c	Tue Dec 09 20:36:39 1997 +0000
@@ -256,6 +256,13 @@
 			return 0;
 		}
 	}
+
+	if (*format != '\0' && !isalpha(*format) &&
+	    *format != '|' && *format != ':' && *format != ';') {
+		PyErr_Format(PyExc_SystemError,
+			     "bad format string: %s", formatsave);
+		return 0;
+	}
 	
 	return 1;
 }