mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-10-29 17:54:14 +08:00
cmd: "port <n> 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.
This commit is contained in:
1 parent
4b9f6c319f
commit
3a9045b97e
1 file changed
+1
-1
+1
-1
@@ -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++;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user