From d55b19b56af3fc8e122a890adad8b56bb05814be Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 22 Aug 2010 14:50:22 +1000 Subject: pyldb: do type checking on the list form of ldb add Pair-Programmed-With: Jelmer Vernooij --- source4/lib/ldb/pyldb.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'source4/lib') diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index 19123c3c24..f1b73a96fb 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -1691,6 +1691,12 @@ struct ldb_message_element *PyObject_AsMessageElement(TALLOC_CTX *mem_ctx, me->values = talloc_array(me, struct ldb_val, me->num_values); for (i = 0; i < me->num_values; i++) { PyObject *obj = PySequence_GetItem(set_obj, i); + if (!PyString_Check(obj)) { + PyErr_Format(PyExc_TypeError, + "Expected string as element %d in list", i); + talloc_free(me); + return NULL; + } me->values[i].length = PyString_Size(obj); me->values[i].data = talloc_memdup(me, -- cgit