From a8d3b7d39a9186d14063f3fa1589e3c03856fb74 Mon Sep 17 00:00:00 2001 From: bloqaudio Date: Mon, 17 Aug 2026 17:19:46 -0500 Subject: [PATCH] cmd_parser: reject port 0 in the ingress command The single-digit arm of the ingress parser guards with p - '1' > 9, which no digit can satisfy: the largest, '9', gives 8. The digit that needed rejecting is '0', which gives -1 and indexes one byte before phys_to_log_port, so "ingress 0 t" reads out of bounds and applies the ingress mode to whatever port number that byte happens to contain. Ports are 1-based, so reject anything below '1'; values above '9' are already excluded by the isnumber check before this. --- cmd_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd_parser.c b/cmd_parser.c index 996e743..d1a9245 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -529,7 +529,7 @@ void parse_ingress(void) if (!isnumber(p)) { continue; } - if (p - '1' > 9) { + if (p < '1') { print_string("Invalid physical port number: "); write_char(p); write_char('\n'); continue; }