]> git.ipfire.org Git - thirdparty/bind9.git/commit
Fix GSS context leak on error paths in process_gsstkey()
authorOndřej Surý <ondrej@sury.org>
Wed, 18 Mar 2026 00:01:34 +0000 (01:01 +0100)
committerOndřej Surý <ondrej@sury.org>
Wed, 1 Apr 2026 05:04:40 +0000 (07:04 +0200)
commitc0a6f3bf659f7385ed8b4e7de7d12d71847bf065
treec1f3dae069c792eadd336f9b58fe2362b0ba3ef3
parent53056796334be7810a427f491679bceba729580a
Fix GSS context leak on error paths in process_gsstkey()

After gss_accept_sec_context() succeeds, the GSS context is passed
to dst_key_fromgssapi() which transfers ownership to the dst_key.
If a subsequent operation fails (dst_key_fromgssapi itself,
dns_tsigkey_createfromkey, or dns_tsigkeyring_add), the cleanup
label frees the dst_key but only if it was created.  If the failure
happened before dst_key_fromgssapi, the GSS context was orphaned.

Delete the GSS context in the cleanup path when it was not
transferred to a dst_key.
lib/dns/tkey.c