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

Bugfix candidate.
This commit is contained in:
Guido van Rossum 2002-04-04 16:22:30 +00:00
parent 4626009493
commit 55474766f0
1 changed files with 7 additions and 1 deletions

View File

@ -1216,7 +1216,13 @@ vgetargskeywords(PyObject *args, PyObject *keywords, char *format,
int pos = 0;
while (PyDict_Next(keywords, &pos, &key, &value)) {
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++) {
if (!strcmp(ks, kwlist[i])) {
match = 1;