From: Joseph Sutton Date: Thu, 24 Aug 2023 23:49:27 +0000 (+1200) Subject: s4:kdc: Don’t operate directly on caller‐owned pointer X-Git-Tag: tevent-0.16.0~616 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bac02f087c966e7935206ca7593f405de071ced3;p=thirdparty%2Fsamba.git s4:kdc: Don’t operate directly on caller‐owned pointer This is more consistent with the other PAC blob functions, and easier to reason about. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- diff --git a/source4/kdc/pac-glue.c b/source4/kdc/pac-glue.c index 8c7601984dd..a8f9ac90c00 100644 --- a/source4/kdc/pac-glue.c +++ b/source4/kdc/pac-glue.c @@ -1882,17 +1882,20 @@ static krb5_error_code samba_kdc_update_device_info(TALLOC_CTX *mem_ctx, static krb5_error_code samba_kdc_get_device_info_pac_blob(TALLOC_CTX *mem_ctx, union PAC_INFO *info, - DATA_BLOB **device_info_blob) + DATA_BLOB **_device_info_blob) { + DATA_BLOB *device_info_blob = NULL; enum ndr_err_code ndr_err; - *device_info_blob = talloc_zero(mem_ctx, DATA_BLOB); - if (*device_info_blob == NULL) { + *_device_info_blob = NULL; + + device_info_blob = talloc_zero(mem_ctx, DATA_BLOB); + if (device_info_blob == NULL) { DBG_ERR("Out of memory\n"); return ENOMEM; } - ndr_err = ndr_push_union_blob(*device_info_blob, *device_info_blob, + ndr_err = ndr_push_union_blob(device_info_blob, device_info_blob, info, PAC_TYPE_DEVICE_INFO, (ndr_push_flags_fn_t)ndr_push_PAC_INFO); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -1902,6 +1905,8 @@ static krb5_error_code samba_kdc_get_device_info_pac_blob(TALLOC_CTX *mem_ctx, return map_errno_from_nt_status(nt_status); } + *_device_info_blob = device_info_blob; + return 0; }