mirror of
https://github.com/isc-projects/bind9.git
synced 2026-05-26 19:34:04 -04:00
[9.20] fix: nil: Release gnamebuf also on the error path
In dst_gssapi_acceptctx(), the gnamebuf could leak a little bit of memory if dns_name_fromtext() would theoretically fail. This would require a Kerberos principal with invalid DNS name. Closes #5737 Backport of MR !11536 Merge branch 'backport-5737-memory-leak-in-dst_gssapi_acceptctx-on-dns_name_fromtext-failure-9.20' into 'bind-9.20' See merge request isc-projects/bind9!11537
This commit is contained in:
commit
bfb55a587d
1 changed files with 9 additions and 9 deletions
|
|
@ -777,15 +777,6 @@ dst_gssapi_acceptctx(dns_gss_cred_id_t cred, const char *gssapi_keytab,
|
|||
|
||||
CHECK(dns_name_fromtext(principal, &namebuf, dns_rootname, 0,
|
||||
NULL));
|
||||
|
||||
if (gnamebuf.length != 0U) {
|
||||
gret = gss_release_buffer(&minor, &gnamebuf);
|
||||
if (gret != GSS_S_COMPLETE) {
|
||||
gss_log(3, "failed gss_release_buffer: %s",
|
||||
gss_error_tostring(gret, minor, buf,
|
||||
sizeof(buf)));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
result = DNS_R_CONTINUE;
|
||||
}
|
||||
|
|
@ -793,6 +784,15 @@ dst_gssapi_acceptctx(dns_gss_cred_id_t cred, const char *gssapi_keytab,
|
|||
*ctxout = context;
|
||||
|
||||
cleanup:
|
||||
if (gnamebuf.length != 0U) {
|
||||
gret = gss_release_buffer(&minor, &gnamebuf);
|
||||
if (gret != GSS_S_COMPLETE) {
|
||||
gss_log(3, "failed gss_release_buffer: %s",
|
||||
gss_error_tostring(gret, minor, buf,
|
||||
sizeof(buf)));
|
||||
}
|
||||
}
|
||||
|
||||
if (gname != NULL) {
|
||||
gret = gss_release_name(&minor, &gname);
|
||||
if (gret != GSS_S_COMPLETE) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue