cli_readline: Only insert printable chars
authorSteve Bennett <steveb@workware.net.au>
Sun, 22 Nov 2020 04:58:45 +0000 (14:58 +1000)
committerTom Rini <trini@konsulko.com>
Sat, 16 Jan 2021 19:49:09 +0000 (14:49 -0500)
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

index 47b876285cc1ff691bff4eca53531d712b903671..5c158d03b4adf58827e3d876f752cc4ba3c4d11f 100644 (file)
@@ -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;
                }
        }