[PATCH] cli: Fix command line underrun
Wang, Peng
Peng.Wang at smartembedded.com
Tue May 4 09:40:00 CEST 2021
>From 7a3110962cd1482793a9912fa14e5d9961e9f01a Mon Sep 17 00:00:00 2001
From: "peng.wang at smartm.com" <peng.wang at smartm.com>
Date: Mon, 3 May 2021 23:53:29 -0700
Subject: [PATCH] cli: Fix command line underrun
This patch adds a column position check to fix the cli issue that
backspace doesn't stop at the prompt.
Signed-off-by: peng.wang at smartm.com <peng.wang at smartm.com>
---
common/cli_readline.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/common/cli_readline.c b/common/cli_readline.c
index c7614a4c90..bce670733f 100644
--- a/common/cli_readline.c
+++ b/common/cli_readline.c
@@ -45,8 +45,10 @@ static char *delete_char (char *buffer, char *p, int *colp, int *np, int plen)
}
}
} else {
- puts(erase_seq);
- (*colp)--;
+ if (*colp > plen) {
+ puts(erase_seq);
+ (*colp)--;
+ }
}
(*np)--;
--
2.31.1.windows.1
More information about the U-Boot
mailing list