From: Maria Matejka Date: Tue, 30 Jan 2024 22:13:49 +0000 (+0100) Subject: Hostentry eattrs are now properly zeroed X-Git-Tag: v3.0.0~269 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=06030d8bf0921bcf333c2d3398f4a9f41ba21e2f;p=thirdparty%2Fbird.git Hostentry eattrs are now properly zeroed --- diff --git a/nest/rt-table.c b/nest/rt-table.c index 80a1c2259..addab2b27 100644 --- a/nest/rt-table.c +++ b/nest/rt-table.c @@ -3336,15 +3336,19 @@ rt_postconfig(struct config *c) void ea_set_hostentry(ea_list **to, rtable *dep, rtable *src, ip_addr gw, ip_addr ll, u32 lnum, u32 labels[lnum]) { - struct hostentry_adata *head = (struct hostentry_adata *) tmp_alloc_adata( - sizeof *head + sizeof(u32) * lnum - sizeof(struct adata)); + struct { + struct hostentry_adata head; + u32 label_space[lnum]; + } h; + + memset(&h, 0, sizeof h); RT_LOCKED(src, tab) - head->he = rt_get_hostentry(tab, gw, ll, dep); - memcpy(head->labels, labels, lnum * sizeof(u32)); + h.head.he = rt_get_hostentry(tab, gw, ll, dep); - ea_set_attr(to, EA_LITERAL_DIRECT_ADATA( - &ea_gen_hostentry, 0, &head->ad)); + memcpy(h.head.labels, labels, lnum * sizeof(u32)); + + ea_set_attr_data(to, &ea_gen_hostentry, 0, h.head.ad.data, (byte *) &h.head.labels[lnum] - h.head.ad.data); }