mirror of
https://github.com/isc-projects/bind9.git
synced 2026-06-11 02:19:59 -04:00
Use offsetof() instead of pointer arithmetics to get slabheader
In rdataset_getheader() a cast of the raw buffer to dns_slabheader_t and pointer arithmetics was used to get the start of the slabheader structure. Use more correct offsetof(dns_slabheader_t, raw) to calculate the correct start of the dns_slabheader_t from the flexible member raw[].
This commit is contained in:
parent
499cfc2f24
commit
b8e07a0b5a
1 changed files with 2 additions and 2 deletions
|
|
@ -801,8 +801,8 @@ rdataset_getownercase(const dns_rdataset_t *rdataset, dns_name_t *name) {
|
|||
|
||||
static dns_slabheader_t *
|
||||
rdataset_getheader(const dns_rdataset_t *rdataset) {
|
||||
dns_slabheader_t *header = (dns_slabheader_t *)rdataset->slab.raw;
|
||||
return header - 1;
|
||||
uint8_t *rawbuf = rdataset->slab.raw;
|
||||
return (dns_slabheader_t *)(rawbuf - offsetof(dns_slabheader_t, raw));
|
||||
}
|
||||
|
||||
dns_slabtop_t *
|
||||
|
|
|
|||
Loading…
Reference in a new issue