summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1994-11-10 22:35:48 (GMT)
committerGuido van Rossum <guido@python.org>1994-11-10 22:35:48 (GMT)
commit13d0ed13c360c09d97ab226562ec6b8ec93290d4 (patch)
tree9843e67a3b7aa824174385e9b92359c72d6ecbd7 /Python/getargs.c
parentc054a663eb748f3a02d1501613aa6a05e37887d6 (diff)
downloadcpython-13d0ed13c360c09d97ab226562ec6b8ec93290d4.zip
cpython-13d0ed13c360c09d97ab226562ec6b8ec93290d4.tar.gz
cpython-13d0ed13c360c09d97ab226562ec6b8ec93290d4.tar.bz2
prevent core dump for old getargs() with NULL arg
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 605cb01..15cd4e6 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -179,6 +179,13 @@ vgetargs1(args, format, va, compat)
return 0;
}
else if (min == 1 && max == 1) {
+ if (args == NULL) {
+ sprintf(msgbuf,
+ "%s requires at least one argument",
+ fname==NULL ? "function" : fname);
+ err_setstr(TypeError, msgbuf);
+ return 0;
+ }
msg = convertitem(args, &format, &va, levels, msgbuf);
if (msg == NULL)
return 1;