mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
parse_passwd() make use of cmd_words_len, change password memcpy.
This commit is contained in:
+9
-5
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user