summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
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 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,