httpd: send_counter(): Validate phys_port_idx and better error handling

This commit is contained in:
René van Dorst
2026-08-25 07:55:17 +02:00
parent 1212def799
commit beb14deba5
3 changed files with 26 additions and 17 deletions
+1 -8
View File
@@ -758,16 +758,9 @@ void httpd_appcall(void)
parse_short(q + 15);
send_vlan(short_parsed);
} else if (is_word(q, "/counters.json")) {
/* The port is one raw character of the request line and
* indexes a nine entry table, so bound it here instead
* of trusting the client to have sent a digit. Anything
* below '0' wraps well past eight, so the one test
* covers both ends. */
uint8_t cport = q[20] - '0';
if (cport > 8)
if (send_counters(cport))
send_bad_request();
else
send_counters(cport);
} else if (is_word(q, "/eee.json")) {
send_eee();
} else if (is_word(q, "/bandwidth.json")) {