]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
CLang compilation fix
authorMaria Matejka <mq@ucw.cz>
Thu, 22 Feb 2024 10:38:13 +0000 (11:38 +0100)
committerMaria Matejka <mq@ucw.cz>
Sat, 18 May 2024 13:41:10 +0000 (15:41 +0200)
nest/rt-table.c

index 79f74d24a2d758b0f4bce9a465a411b284582a05..baa1f04a95848f03517b9a405b73b52bc46dfc39 100644 (file)
@@ -3342,17 +3342,18 @@ ea_set_hostentry(ea_list **to, rtable *dep, rtable *src, ip_addr gw, ip_addr ll,
 {
   struct {
     struct hostentry_adata head;
-    u32 label_space[lnum];
-  } h;
-
-  memset(&h, 0, sizeof h);
+    u32 label_space[];
+  } *h;
+  u32 sz = sizeof *h + lnum * sizeof(u32);
+  h = alloca(sz);
+  memset(h, 0, sz);
 
   RT_LOCKED(src, tab)
-    h.head.he = rt_get_hostentry(tab, gw, ll, dep);
+    h->head.he = rt_get_hostentry(tab, gw, ll, dep);
 
-  memcpy(h.head.labels, labels, lnum * sizeof(u32));
+  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);
+  ea_set_attr_data(to, &ea_gen_hostentry, 0, h->head.ad.data, (byte *) &h->head.labels[lnum] - h->head.ad.data);
 }