]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
prevent core dump for old getargs() with NULL arg
authorGuido van Rossum <guido@python.org>
Thu, 10 Nov 1994 22:35:48 +0000 (22:35 +0000)
committerGuido van Rossum <guido@python.org>
Thu, 10 Nov 1994 22:35:48 +0000 (22:35 +0000)
Python/getargs.c

index 605cb01957535d7312160713a73dc0020f01b5ef..15cd4e6ce482104cc8e778f9f9a5b78711b5cbb2 100644 (file)
@@ -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;