From 5d0d17a92db235cecb5bbe4c6a0efc29a294c745 Mon Sep 17 00:00:00 2001 From: Douglas Bagnall Date: Fri, 29 Dec 2023 15:15:48 +1300 Subject: [PATCH] ndr: skip talloc when pulling empty DATA_BLOB Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett BUG: https://bugzilla.samba.org/show_bug.cgi?id=15574 (cherry picked from commit c2673b02a7a51761e8b6631eb0c0e7062cbbed7b) --- librpc/ndr/ndr_basic.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/librpc/ndr/ndr_basic.c b/librpc/ndr/ndr_basic.c index fc8620f28c7..5fd15730a74 100644 --- a/librpc/ndr/ndr_basic.c +++ b/librpc/ndr/ndr_basic.c @@ -1453,6 +1453,12 @@ _PUBLIC_ enum ndr_err_code ndr_pull_DATA_BLOB(struct ndr_pull *ndr, ndr_flags_ty } else { NDR_CHECK(ndr_pull_uint3264(ndr, NDR_SCALARS, &length)); } + if (length == 0) { + /* skip the talloc for an empty blob */ + blob->data = NULL; + blob->length = 0; + return NDR_ERR_SUCCESS; + } NDR_PULL_NEED_BYTES(ndr, length); *blob = data_blob_talloc(ndr->current_mem_ctx, ndr->data+ndr->offset, length); ndr->offset += length; -- 2.11.4.GIT