From 3a9045b97ea3dc9cb7070cc1bc0a77b8a854eb38 Mon Sep 17 00:00:00 2001 From: d00f <8052722+DrDoof@users.noreply.github.com> Date: Wed, 23 Sep 2026 17:46:05 +0200 Subject: [PATCH] cmd: "port name" without a name clears it instead of reading stale words The name branch read the fourth word without checking that the line had one, and the tokenizer does not reset unused word slots, so "port 5 name" took the name from wherever the previous command's fourth word had been: "port 5 name hello" followed by "port 5 name" gave "hello" again, and after a longer line it gave the tail of that line. The web UI never sends the form, the console can. With no argument the name is now empty, which also gives the console a way to remove a name. --- cmd_parser.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd_parser.c b/cmd_parser.c index 5b4e1f34..e621ef34 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -901,7 +901,7 @@ void parse_port(void) port_media_show(phy_settings.port); } else if (cmd_compare(2, "name")) { uint8_t i = 0; - while ( (i < PORT_NAME_SIZE-1) && (cmd_buffer[cmd_words_b[3] + i] != NUL) ) { + while ( cmd_words_len > 3 && (i < PORT_NAME_SIZE-1) && (cmd_buffer[cmd_words_b[3] + i] != NUL) ) { port_names[phy_settings.port][i] = name_char(cmd_buffer[cmd_words_b[3] + i]); i++; }