From 0d698dc57230aae2e056d46d773b94c699225b6d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20van=20Dorst?= Date: Fri, 17 Apr 2026 23:32:18 +0200 Subject: [PATCH] parse_passwd() make use of cmd_words_len, change password memcpy. --- cmd_parser.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/cmd_parser.c b/cmd_parser.c index f239cba..f7381de 100644 --- a/cmd_parser.c +++ b/cmd_parser.c @@ -1035,11 +1035,15 @@ void parse_rnd(void) void parse_passwd(void) { - if (cmd_words_b[2] > 0) { - signed char i; - signed char j = 0; - for (i = cmd_words_b[1]; (i != cmd_words_b[2] && i - cmd_words_b[1] < 20); i++) - passwd[j++] = cmd_buffer[i]; + // cmd_words_len can be more then 2 if a space in the password. + if (cmd_words_len >= 2) { + uint8_t i = cmd_words_b[1]; + uint8_t c = 0; + uint8_t j = 0; + do { + c = cmd_buffer[i++]; + passwd[j++] = c; + } while (c != '\0' && j < 20); passwd[j] = '\0'; return; }