]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc: Don’t operate directly on caller‐owned pointer
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Thu, 24 Aug 2023 23:49:27 +0000 (11:49 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 14 Sep 2023 21:35:29 +0000 (21:35 +0000)
This is more consistent with the other PAC blob functions, and easier to
reason about.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/kdc/pac-glue.c

index 8c7601984ddbd86fa1af436ed87729351b8a0878..a8f9ac90c00689b3ecb3c1d7fbc34e084fe4eea1 100644 (file)
@@ -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;
 }