diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h index 38fe60c946d4..08c588bbfdcd 100644 --- a/sys/netlink/netlink_snl.h +++ b/sys/netlink/netlink_snl.h @@ -1095,6 +1095,16 @@ snl_realloc_msg_buffer(struct snl_writer *nw, size_t sz) } nw->base = (char *)new_base; } +#ifdef __CHERI_PURE_CAPABILITY__ + if (cheri_getlen(new_base) != cheri_getlen(nw->base)) { + nw->base = (char *)cheri_setboundsexact(new_base, nw->size); + if (nw->hdr != NULL) { + int hdr_off = (char *)(nw->hdr) - nw->base; + nw->hdr = (struct nlmsghdr *) + (void *)((char *)nw->base + hdr_off); + } + } +#endif return (true); }