host: fix crash parsing gateway when no endpoint is specified
authorFelix Fietkau <nbd@nbd.name>
Tue, 30 May 2023 18:11:13 +0000 (20:11 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 30 May 2023 18:11:14 +0000 (20:11 +0200)
Signed-off-by: Felix Fietkau <nbd@nbd.name>
host.c

diff --git a/host.c b/host.c
index 7522e8b1fba8ee0140ff9d7ebb0914b98017114c..e4e38d33079978b6f4f5c402c601aa1e1d9c15eb 100644 (file)
--- a/host.c
+++ b/host.c
@@ -179,7 +179,7 @@ network_host_create(struct network *net, struct blob_attr *attr, bool dynamic)
                                &ipaddr, ipaddr_len,
                                &subnet, subnet_len,
                                &endpoint_buf, endpoint ? strlen(endpoint) + 1 : 0,
-                               &gateway_buf, gateway ? strlen(endpoint) + 1 : 0);
+                               &gateway_buf, gateway ? strlen(gateway) + 1 : 0);
                host->node.key = strcpy(name_buf, name);
                peer = &host->peer;
        }