mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
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! ........
This commit is contained in:
parent
73ad434945
commit
e5fd21f11f
2 changed files with 10 additions and 2 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue