From: Douglas Bagnall Date: Thu, 10 Aug 2023 02:26:11 +0000 (+1200) Subject: lib/util: strhex_to_data_blob checks talloc X-Git-Tag: tevent-0.16.0~828 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4504324ea4c8d9c2f29bc64479221b87837da4ce;p=thirdparty%2Fsamba.git lib/util: strhex_to_data_blob checks talloc Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/lib/util/util.c b/lib/util/util.c index b35ba115a7a..9d935d5f192 100644 --- a/lib/util/util.c +++ b/lib/util/util.c @@ -1006,7 +1006,10 @@ _PUBLIC_ size_t strhex_to_str(char *p, size_t p_len, const char *strhex, size_t _PUBLIC_ DATA_BLOB strhex_to_data_blob(TALLOC_CTX *mem_ctx, const char *strhex) { DATA_BLOB ret_blob = data_blob_talloc(mem_ctx, NULL, strlen(strhex)/2+1); - + if (ret_blob.data == NULL) { + /* ret_blob.length is already 0 */ + return ret_blob; + } ret_blob.length = strhex_to_str((char *)ret_blob.data, ret_blob.length, strhex, strlen(strhex));