diff mbox series

cli_readline: Only insert printable chars

Message ID 20201122045845.62456-1-steveb@workware.net.au
State New
Delegated to: Tom Rini
Headers show
Series cli_readline: Only insert printable chars | expand

Commit Message

Steve Bennett Nov. 22, 2020, 4:58 a.m. UTC
There should be no need to insert non-printable characters
and this prevents line editing getting confused.

Signed-off-by: Steve Bennett <steveb@workware.net.au>
---
 common/cli_readline.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/common/cli_readline.c b/common/cli_readline.c
index 47b876285c..5c158d03b4 100644
--- a/common/cli_readline.c
+++ b/common/cli_readline.c
@@ -493,8 +493,10 @@  static int cread_line(const char *const prompt, char *buf, unsigned int *len,
 		}
 #endif
 		default:
-			cread_add_char(ichar, insert, &num, &eol_num, buf,
-				       *len);
+			if (ichar >= ' ' && ichar <= '~') {
+				cread_add_char(ichar, insert, &num, &eol_num,
+					       buf, *len);
+			}
 			break;
 		}
 	}