Commit 9b0c4bf7 authored by Brian Wellington's avatar Brian Wellington
Browse files

675. [func] TKEY queries could cause the server to leak

                        memory.
parent de832d13
675. [func] TKEY queries could cause the server to leak
memory.
674. [func] Allow messages to be TSIG signed / verified using
a offset from the current time.
......
......@@ -16,7 +16,7 @@
*/
/*
* $Id: tkey.c,v 1.59 2001/01/11 04:00:17 bwelling Exp $
* $Id: tkey.c,v 1.60 2001/01/11 04:23:39 bwelling Exp $
*/
#include <config.h>
......@@ -154,19 +154,39 @@ add_rdata_to_list(dns_message_t *msg, dns_name_t *name, dns_rdata_t *rdata,
return (ISC_R_SUCCESS);
failure:
if (newrdata != NULL)
if (newrdata != NULL) {
if (ISC_LINK_LINKED(newrdata, link))
ISC_LIST_UNLINK(newlist->rdata, newrdata, link);
dns_message_puttemprdata(msg, &newrdata);
}
if (newname != NULL)
dns_message_puttempname(msg, &newname);
if (newlist != NULL)
dns_message_puttemprdatalist(msg, &newlist);
if (newset != NULL) {
dns_rdataset_disassociate(newset);
dns_message_puttemprdataset(msg, &newset);
}
if (newlist != NULL)
dns_message_puttemprdatalist(msg, &newlist);
return (result);
}
static void
free_namelist(dns_message_t *msg, dns_namelist_t *namelist) {
dns_name_t *name;
dns_rdataset_t *set;
while (!ISC_LIST_EMPTY(*namelist)) {
name = ISC_LIST_HEAD(*namelist);
ISC_LIST_UNLINK(*namelist, name, link);
while (!ISC_LIST_EMPTY(name->list)) {
set = ISC_LIST_HEAD(name->list);
ISC_LIST_UNLINK(name->list, set, link);
dns_message_puttemprdataset(msg, &set);
}
dns_message_puttempname(msg, &name);
}
}
static isc_result_t
compute_secret(isc_buffer_t *shared, isc_region_t *queryrandomness,
isc_region_t *serverrandomness, isc_buffer_t *secret)
......@@ -777,6 +797,8 @@ dns_tkey_processquery(dns_message_t *msg, dns_tkeyctx_t *tctx,
dns_message_puttemprdata(msg, &rdata);
if (dynbuf != NULL)
isc_buffer_free(&dynbuf);
if (!ISC_LIST_EMPTY(namelist))
free_namelist(msg, &namelist);
return (result);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment