parse_passwd() make use of cmd_words_len, change password memcpy.

This commit is contained in:
René van Dorst
2026-04-18 19:35:51 +02:00
parent c7fb354f08
commit 0d698dc572
+9 -5
View File
@@ -1035,11 +1035,15 @@ void parse_rnd(void)
void parse_passwd(void) void parse_passwd(void)
{ {
if (cmd_words_b[2] > 0) { // cmd_words_len can be more then 2 if a space in the password.
signed char i; if (cmd_words_len >= 2) {
signed char j = 0; uint8_t i = cmd_words_b[1];
for (i = cmd_words_b[1]; (i != cmd_words_b[2] && i - cmd_words_b[1] < 20); i++) uint8_t c = 0;
passwd[j++] = cmd_buffer[i]; uint8_t j = 0;
do {
c = cmd_buffer[i++];
passwd[j++] = c;
} while (c != '\0' && j < 20);
passwd[j] = '\0'; passwd[j] = '\0';
return; return;
} }