From fa9f9d491571d538559c873e166365ece28f4d73 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Fri, 28 Jul 2023 08:14:47 +1200 Subject: [PATCH] python: Check return value of talloc_strndup() Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- python/modules.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/modules.c b/python/modules.c index 0b3cdb0681e..cacca63bbb3 100644 --- a/python/modules.c +++ b/python/modules.c @@ -102,6 +102,11 @@ char **PyList_AsStringList(TALLOC_CTX *mem_ctx, PyObject *list, return NULL; } ret[i] = talloc_strndup(ret, value, size); + if (ret[i] == NULL) { + PyErr_NoMemory(); + talloc_free(ret); + return NULL; + } } ret[i] = NULL; return ret;