Commit 55474766 authored by Guido van Rossum's avatar Guido van Rossum

Fix by Greg Chapman from SF bug 534347: Potential AV in vgetargskeywords.

Bugfix candidate.
parent 46260094
...@@ -1216,7 +1216,13 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format, ...@@ -1216,7 +1216,13 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
int pos = 0; int pos = 0;
while (PyDict_Next(keywords, &pos, &key, &value)) { while (PyDict_Next(keywords, &pos, &key, &value)) {
int match = 0; int match = 0;
char *ks = PyString_AsString(key); char *ks;
if (!PyString_Check(key)) {
PyErr_SetString(PyExc_TypeError,
"keywords must be strings");
return 0;
}
ks = PyString_AsString(key);
for (i = 0; i < max; i++) { for (i = 0; i < max; i++) {
if (!strcmp(ks, kwlist[i])) { if (!strcmp(ks, kwlist[i])) {
match = 1; match = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment