1 From c3797d40a1c57352192c6106cc0f435e7d9c11e8 Mon Sep 17 00:00:00 2001
2 From: Denys Vlasenko <vda.linux@googlemail.com>
3 Date: Tue, 7 Nov 2017 18:09:29 +0100
4 Subject: lineedit: do not tab-complete any strings which have control
10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
12 libbb/lineedit.c | 12 ++++++++++++
13 1 file changed, 12 insertions(+)
15 diff --git a/libbb/lineedit.c b/libbb/lineedit.c
16 index c0e35bb..56e8140 100644
17 --- a/libbb/lineedit.c
18 +++ b/libbb/lineedit.c
19 @@ -645,6 +645,18 @@ static void free_tab_completion_data(void)
21 static void add_match(char *matched)
23 + unsigned char *p = (unsigned char*)matched;
25 + /* ESC attack fix: drop any string with control chars */
27 + || (!ENABLE_UNICODE_SUPPORT && *p >= 0x7f)
28 + || (ENABLE_UNICODE_SUPPORT && *p == 0x7f)
35 matches = xrealloc_vector(matches, 4, num_matches);
36 matches[num_matches] = matched;