summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-08-22 14:50:22 +1000
committerAndrew Tridgell <tridge@samba.org>2010-08-22 14:57:34 +1000
commitd55b19b56af3fc8e122a890adad8b56bb05814be (patch)
tree017fc53f8abdbf0fc777d9e45e00c3441324db9d /source4
parent24159a59a3b404346e7931ef8817d09eeeb0711f (diff)
downloadsamba-d55b19b56af3fc8e122a890adad8b56bb05814be.tar.gz
pyldb: do type checking on the list form of ldb add
Pair-Programmed-With: Jelmer Vernooij <jelmer@samba.org>
Diffstat (limited to 'source4')
-rw-r--r--source4/lib/ldb/pyldb.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 19123c3c249..f1b73a96fb7 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,