mirror of
https://github.com/samba-team/samba.git
synced 2025-01-11 05:18:09 +03:00
pyrpc: ndr PY_CHECK_TYPE checks for NULL as well as type
Addresses CID 1361477 and others. Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz> Reviewed-by: Gary Lockyer <gary@catalyst.net.nz>
This commit is contained in:
parent
4954a96e45
commit
0606860308
@ -26,10 +26,19 @@
|
||||
#define Py_TYPE(ob) (((PyObject*)(ob))->ob_type)
|
||||
#endif
|
||||
|
||||
#define PY_CHECK_TYPE(type, var, fail) \
|
||||
if (!PyObject_TypeCheck(var, type)) {\
|
||||
PyErr_Format(PyExc_TypeError, __location__ ": Expected type '%s' for '%s' of type '%s'", (type)->tp_name, #var, Py_TYPE(var)->tp_name); \
|
||||
fail; \
|
||||
#define PY_CHECK_TYPE(type, var, fail) \
|
||||
if (var == NULL) { \
|
||||
PyErr_Format(PyExc_TypeError, \
|
||||
__location__ \
|
||||
": Expected type '%s' for '%s', got NULL", \
|
||||
(type)->tp_name, #var); \
|
||||
fail; \
|
||||
} else if (!PyObject_TypeCheck(var, type)) { \
|
||||
PyErr_Format(PyExc_TypeError, \
|
||||
__location__ \
|
||||
": Expected type '%s' for '%s' of type '%s'", \
|
||||
(type)->tp_name, #var, Py_TYPE(var)->tp_name); \
|
||||
fail; \
|
||||
}
|
||||
|
||||
#define dom_sid0_Type dom_sid_Type
|
||||
|
Loading…
Reference in New Issue
Block a user