All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Bennett <steveb@workware.net.au>
To: u-boot@lists.denx.de
Subject: [PATCH] cli_readline: Only insert printable chars
Date: Sun, 22 Nov 2020 14:58:45 +1000	[thread overview]
Message-ID: <20201122045845.62456-1-steveb@workware.net.au> (raw)

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 --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;
 		}
 	}
-- 
2.24.2 (Apple Git-127)

             reply	other threads:[~2020-11-22  4:58 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-22  4:58 Steve Bennett [this message]
2021-01-18 13:00 ` [PATCH] cli_readline: Only insert printable chars Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201122045845.62456-1-steveb@workware.net.au \
    --to=steveb@workware.net.au \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.