]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s4:kdc:db-glue talloc steal pub_key data
authorGary Lockyer <gary@catalyst.net.nz>
Wed, 6 Aug 2025 01:00:32 +0000 (13:00 +1200)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 6 Aug 2025 04:07:37 +0000 (04:07 +0000)
talloc_steal the data pointers of pub_key, modulus and exponent onto pub_key.
To allow fuzz testing of ndr_pull_KeyMaterialInternal the KeyMaterialInternal
struct may not be a talloc_context.  So the data portions will be allocated on
the ndr context.

Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source4/kdc/db-glue.c

index f3e8bd9073c10e321577eab2e9726b98fedeacd1..a776dc008e6685d1b096fa99d52d0816c3c35cf4 100644 (file)
@@ -1305,6 +1305,11 @@ static krb5_error_code unpack_key_credential_link_blob(
                TALLOC_FREE(*pub_key);
                goto out;
        }
+       /*
+        * Steal modulus and exponent data from the ndr context onto the pub_key
+        */
+       talloc_steal(*pub_key, (*pub_key)->modulus.data);
+       talloc_steal(*pub_key, (*pub_key)->exponent.data);
 
 out:
        TALLOC_FREE(tmp_ctx);