mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 10:10:06 +00:00
use get_uint16() to read count and rdlen
use the same macro defned for rdataslab.c to get count and length values from raw slabs in qpzone.c.
This commit is contained in:
parent
04d6412558
commit
712ef31a0c
@ -1111,12 +1111,11 @@ setnsec3parameters(dns_db_t *db, qpz_version_t *version) {
|
|||||||
* Find an NSEC3PARAM with a supported algorithm.
|
* Find an NSEC3PARAM with a supported algorithm.
|
||||||
*/
|
*/
|
||||||
raw = dns_slabheader_raw(found);
|
raw = dns_slabheader_raw(found);
|
||||||
count = raw[0] * 256 + raw[1]; /* count */
|
count = get_uint16(raw);
|
||||||
raw += DNS_RDATASET_LENGTH;
|
|
||||||
while (count-- > 0U) {
|
while (count-- > 0U) {
|
||||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||||
length = raw[0] * 256 + raw[1];
|
|
||||||
raw += DNS_RDATASET_LENGTH;
|
length = get_uint16(raw);
|
||||||
region.base = raw;
|
region.base = raw;
|
||||||
region.length = length;
|
region.length = length;
|
||||||
raw += length;
|
raw += length;
|
||||||
@ -2617,14 +2616,12 @@ matchparams(dns_slabheader_t *header, qpz_search_t *search) {
|
|||||||
REQUIRE(header->typepair == DNS_TYPEPAIR(dns_rdatatype_nsec3));
|
REQUIRE(header->typepair == DNS_TYPEPAIR(dns_rdatatype_nsec3));
|
||||||
|
|
||||||
raw = (unsigned char *)header + sizeof(*header);
|
raw = (unsigned char *)header + sizeof(*header);
|
||||||
count = raw[0] * 256 + raw[1]; /* count */
|
count = get_uint16(raw);
|
||||||
raw += DNS_RDATASET_LENGTH;
|
|
||||||
|
|
||||||
while (count-- > 0) {
|
while (count-- > 0) {
|
||||||
dns_rdata_t rdata = DNS_RDATA_INIT;
|
dns_rdata_t rdata = DNS_RDATA_INIT;
|
||||||
|
|
||||||
rdlen = raw[0] * 256 + raw[1];
|
rdlen = get_uint16(raw);
|
||||||
raw += DNS_RDATASET_LENGTH;
|
|
||||||
region.base = raw;
|
region.base = raw;
|
||||||
region.length = rdlen;
|
region.length = rdlen;
|
||||||
dns_rdata_fromregion(&rdata, search->qpdb->common.rdclass,
|
dns_rdata_fromregion(&rdata, search->qpdb->common.rdclass,
|
||||||
|
@ -49,19 +49,6 @@
|
|||||||
* When a slab is created, data records are sorted into DNSSEC order.
|
* When a slab is created, data records are sorted into DNSSEC order.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define peek_uint16(buffer) ({ ((uint16_t)*(buffer) << 8) | *((buffer) + 1); })
|
|
||||||
#define get_uint16(buffer) \
|
|
||||||
({ \
|
|
||||||
uint16_t __ret = peek_uint16(buffer); \
|
|
||||||
buffer += sizeof(uint16_t); \
|
|
||||||
__ret; \
|
|
||||||
})
|
|
||||||
#define put_uint16(buffer, val) \
|
|
||||||
({ \
|
|
||||||
*buffer++ = (val & 0xff00) >> 8; \
|
|
||||||
*buffer++ = (val & 0x00ff); \
|
|
||||||
})
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rdataset_disassociate(dns_rdataset_t *rdataset DNS__DB_FLARG);
|
rdataset_disassociate(dns_rdataset_t *rdataset DNS__DB_FLARG);
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
|
@ -57,3 +57,16 @@
|
|||||||
#define ZEROTTL(header) \
|
#define ZEROTTL(header) \
|
||||||
((atomic_load_acquire(&(header)->attributes) & \
|
((atomic_load_acquire(&(header)->attributes) & \
|
||||||
DNS_SLABHEADERATTR_ZEROTTL) != 0)
|
DNS_SLABHEADERATTR_ZEROTTL) != 0)
|
||||||
|
|
||||||
|
#define peek_uint16(buffer) ({ ((uint16_t)*(buffer) << 8) | *((buffer) + 1); })
|
||||||
|
#define get_uint16(buffer) \
|
||||||
|
({ \
|
||||||
|
uint16_t __ret = peek_uint16(buffer); \
|
||||||
|
buffer += sizeof(uint16_t); \
|
||||||
|
__ret; \
|
||||||
|
})
|
||||||
|
#define put_uint16(buffer, val) \
|
||||||
|
({ \
|
||||||
|
*buffer++ = (val & 0xff00) >> 8; \
|
||||||
|
*buffer++ = (val & 0x00ff); \
|
||||||
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user