summaryrefslogtreecommitdiffstats
path: root/Python/getargs.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-04-04 16:22:30 (GMT)
committerGuido van Rossum <guido@python.org>2002-04-04 16:22:30 (GMT)
commit55474766f0e0950c1c029aa910df7e850d1a1d8f (patch)
tree54788d6d04ff26841a69df1db0ec68f8c6ddbe97 /Python/getargs.c
parent46260094931ef75871f0037957c00611b0bb03ad (diff)
downloadcpython-55474766f0e0950c1c029aa910df7e850d1a1d8f.zip
cpython-55474766f0e0950c1c029aa910df7e850d1a1d8f.tar.gz
cpython-55474766f0e0950c1c029aa910df7e850d1a1d8f.tar.bz2
Fix by Greg Chapman from SF bug 534347: Potential AV in vgetargskeywords.
Bugfix candidate.
Diffstat (limited to 'Python/getargs.c')
-rw-r--r--Python/getargs.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/getargs.c b/Python/getargs.c
index 411c695..280ffc3 100644
--- a/Python/getargs.c
+++ b/Python/getargs.c
@@ -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;