From: Joseph Sutton Date: Thu, 27 Jul 2023 20:14:47 +0000 (+1200) Subject: python: Check return value of talloc_strndup() X-Git-Tag: tevent-0.16.0~1195 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fa9f9d491571d538559c873e166365ece28f4d73;p=thirdparty%2Fsamba.git python: Check return value of talloc_strndup() Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- 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;