From 333e1efa27f1d99bbfc69d94d3bf47e7b99c1e40 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Mon, 5 Aug 2019 00:28:31 +1200 Subject: pyglue: check talloc buffer for random bytes Signed-off-by: Douglas Bagnall Reviewed-by: Andreas Schneider --- python/pyglue.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'python') diff --git a/python/pyglue.c b/python/pyglue.c index 0e1bf82fa7a..5ee2b68b8ad 100644 --- a/python/pyglue.c +++ b/python/pyglue.c @@ -101,6 +101,10 @@ static PyObject *py_generate_random_bytes(PyObject *self, PyObject *args) return NULL; bytes = talloc_zero_size(NULL, len); + if (bytes == NULL) { + PyErr_NoMemory(); + return NULL; + } generate_random_buffer(bytes, len); ret = PyBytes_FromStringAndSize((const char *)bytes, len); talloc_free(bytes); -- cgit v1.2.3