diff options
author | Larry Hastings <larry@hastings.org> | 2010-02-24 22:58:18 (GMT) |
---|---|---|
committer | Larry Hastings <larry@hastings.org> | 2010-02-24 22:58:18 (GMT) |
commit | e5fd21f11f09c106b0b77a1dee2c25e69f48b84a (patch) | |
tree | ee1c332ad0a288a4e1bf787142b081472d9443f5 /Modules/_ctypes | |
parent | 73ad434945f520337f55f23695221d766d066969 (diff) | |
download | cpython-e5fd21f11f09c106b0b77a1dee2c25e69f48b84a.zip cpython-e5fd21f11f09c106b0b77a1dee2c25e69f48b84a.tar.gz cpython-e5fd21f11f09c106b0b77a1dee2c25e69f48b84a.tar.bz2 |
Merged revisions 78435 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r78435 | larry.hastings | 2010-02-24 17:49:58 -0500 (Wed, 24 Feb 2010) | 4 lines
Issue #5939: Add additional runtime checking to ensure a valid capsule
in Modules/_ctypes/callproc.c. Reviewed by Benjamin P. My first commit!
........
Diffstat (limited to 'Modules/_ctypes')
-rw-r--r-- | Modules/_ctypes/callproc.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Modules/_ctypes/callproc.c b/Modules/_ctypes/callproc.c index f5eaa0d..2a75fb1 100644 --- a/Modules/_ctypes/callproc.c +++ b/Modules/_ctypes/callproc.c @@ -139,8 +139,14 @@ _ctypes_get_errobj(int **pspace) return NULL; } errobj = PyDict_GetItem(dict, error_object_name); - if (errobj) + if (errobj) { + if (!PyCapsule_IsValid(errobj, CTYPES_CAPSULE_NAME_PYMEM)) { + PyErr_SetString(PyExc_RuntimeError, + "ctypes.error_object is an invalid capsule"); + return NULL; + } Py_INCREF(errobj); + } else { void *space = PyMem_Malloc(sizeof(int) * 2); if (space == NULL) |