Skip to contentSkip to conversation

cli_readline: Only insert printable chars

PATCH New Steve Bennett 2 participants 2 messages Nov 22, 2020 – Jan 18, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cli_readline: Only insert printable chars

There should be no need to insert non-printable characters and this prevents line editing getting confused.

---
 common/cli_readline.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
common/cli_readline.c +4 -2
index 47b876285c..5c158d03b4 100644
@@ -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;
 		}
 	}
Signature · 1 line
2.24.2 (Apple Git-127)
#1 lore raw

PATCH 1/1 cli_readline: Only insert printable chars

Quoted 4 lines · Steve Bennett

There should be no need to insert non-printable characters and this prevents line editing getting confused.

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210118/6edda5dc/attachment.sig>