Skip to content

Commit 6f2dcf9

Browse files
committed
no VLA
1 parent 578e526 commit 6f2dcf9

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

mongoose.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4365,8 +4365,8 @@ static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
43654365
(ifp->enable_req_sntp ? 1 : 0));
43664366
size_t len = strlen(ifp->dhcp_name);
43674367
size_t olen = 21 + len + extra + 2 + 1; // Total length of options
4368-
uint8_t opts_maxlen = 21 + sizeof(ifp->dhcp_name) + 2 + 2 + 1;
4369-
uint8_t opts[opts_maxlen]; // Allocate options (max size possible)
4368+
#define OPTS_MAXLEN (21 + sizeof(ifp->dhcp_name) + 2 + 2 + 1)
4369+
uint8_t opts[OPTS_MAXLEN]; // Allocate options (max size possible)
43704370
uint8_t *p = opts;
43714371
assert(olen <= sizeof(opts));
43724372
memset(opts, 0, sizeof(opts));

src/net_builtin.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -284,8 +284,8 @@ static void tx_dhcp_request_sel(struct mg_tcpip_if *ifp, uint32_t ip_req,
284284
(ifp->enable_req_sntp ? 1 : 0));
285285
size_t len = strlen(ifp->dhcp_name);
286286
size_t olen = 21 + len + extra + 2 + 1; // Total length of options
287-
uint8_t opts_maxlen = 21 + sizeof(ifp->dhcp_name) + 2 + 2 + 1;
288-
uint8_t opts[opts_maxlen]; // Allocate options (max size possible)
287+
#define OPTS_MAXLEN (21 + sizeof(ifp->dhcp_name) + 2 + 2 + 1)
288+
uint8_t opts[OPTS_MAXLEN]; // Allocate options (max size possible)
289289
uint8_t *p = opts;
290290
assert(olen <= sizeof(opts));
291291
memset(opts, 0, sizeof(opts));

0 commit comments

Comments
 (0)