From 6f2dcf92a7747ca1b7f711eb9b9db9e73a3e7fe4 Mon Sep 17 00:00:00 2001 From: "Sergio R. Caprile" Date: Wed, 9 Apr 2025 10:28:31 -0300 Subject: [PATCH] no VLA --- mongoose.c | 4 ++-- src/net_builtin.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mongoose.c b/mongoose.c index 1e9cdcfe..9673fad3 100644 --- a/mongoose.c +++ b/mongoose.c @@ -4365,8 +4365,8 @@ static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req, (ifp->enable_req_sntp ? 1 : 0)); size_t len = strlen(ifp->dhcp_name); size_t olen = 21 + len + extra + 2 + 1; // Total length of options - uint8_t opts_maxlen = 21 + sizeof(ifp->dhcp_name) + 2 + 2 + 1; - uint8_t opts[opts_maxlen]; // Allocate options (max size possible) + #define OPTS_MAXLEN (21 + sizeof(ifp->dhcp_name) + 2 + 2 + 1) + uint8_t opts[OPTS_MAXLEN]; // Allocate options (max size possible) uint8_t *p = opts; assert(olen <= sizeof(opts)); memset(opts, 0, sizeof(opts)); diff --git a/src/net_builtin.c b/src/net_builtin.c index 1245245a..3b9d7a18 100644 --- a/src/net_builtin.c +++ b/src/net_builtin.c @@ -284,8 +284,8 @@ static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req, (ifp->enable_req_sntp ? 1 : 0)); size_t len = strlen(ifp->dhcp_name); size_t olen = 21 + len + extra + 2 + 1; // Total length of options - uint8_t opts_maxlen = 21 + sizeof(ifp->dhcp_name) + 2 + 2 + 1; - uint8_t opts[opts_maxlen]; // Allocate options (max size possible) + #define OPTS_MAXLEN (21 + sizeof(ifp->dhcp_name) + 2 + 2 + 1) + uint8_t opts[OPTS_MAXLEN]; // Allocate options (max size possible) uint8_t *p = opts; assert(olen <= sizeof(opts)); memset(opts, 0, sizeof(opts));