mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 22:15:20 +00:00
3013. [bug] The DNS64 ttl was not always being set as expected.
[RT #23034]
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
/* $Id: rdataslab.c,v 1.52 2010/02/25 05:08:01 tbox Exp $ */
|
||||
/* $Id: rdataslab.c,v 1.53 2011/02/03 07:35:56 marka Exp $ */
|
||||
|
||||
/*! \file */
|
||||
|
||||
@@ -144,21 +144,25 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
|
||||
|
||||
nalloc = dns_rdataset_count(rdataset);
|
||||
nitems = nalloc;
|
||||
if (nitems == 0)
|
||||
if (nitems == 0 && rdataset->type != 0)
|
||||
return (ISC_R_FAILURE);
|
||||
|
||||
if (nalloc > 0xffff)
|
||||
return (ISC_R_NOSPACE);
|
||||
|
||||
x = isc_mem_get(mctx, nalloc * sizeof(struct xrdata));
|
||||
if (x == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
|
||||
if (nalloc != 0) {
|
||||
x = isc_mem_get(mctx, nalloc * sizeof(struct xrdata));
|
||||
if (x == NULL)
|
||||
return (ISC_R_NOMEMORY);
|
||||
} else
|
||||
x = NULL;
|
||||
|
||||
/*
|
||||
* Save all of the rdata members into an array.
|
||||
*/
|
||||
result = dns_rdataset_first(rdataset);
|
||||
if (result != ISC_R_SUCCESS)
|
||||
if (result != ISC_R_SUCCESS && result != ISC_R_NOMORE)
|
||||
goto free_rdatas;
|
||||
for (i = 0; i < nalloc && result == ISC_R_SUCCESS; i++) {
|
||||
INSIST(result == ISC_R_SUCCESS);
|
||||
@@ -223,11 +227,14 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
|
||||
/*
|
||||
* Don't forget the last item!
|
||||
*/
|
||||
if (nalloc != 0) {
|
||||
#if DNS_RDATASET_FIXED
|
||||
buflen += (8 + x[i-1].rdata.length);
|
||||
buflen += (8 + x[i-1].rdata.length);
|
||||
#else
|
||||
buflen += (2 + x[i-1].rdata.length);
|
||||
buflen += (2 + x[i-1].rdata.length);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* Provide space to store the per RR meta data.
|
||||
*/
|
||||
@@ -316,7 +323,8 @@ dns_rdataslab_fromrdataset(dns_rdataset_t *rdataset, isc_mem_t *mctx,
|
||||
result = ISC_R_SUCCESS;
|
||||
|
||||
free_rdatas:
|
||||
isc_mem_put(mctx, x, nalloc * sizeof(struct xrdata));
|
||||
if (x != NULL)
|
||||
isc_mem_put(mctx, x, nalloc * sizeof(struct xrdata));
|
||||
return (result);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user