lantiq: fix wbmr-hp-g300h image metadata
[openwrt/openwrt.git] / package / utils / busybox / patches / 600-cve-2017-16544.patch
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
5 characters
6
7 function old new delta
8 add_match 41 68 +27
9
10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
11 ---
12 libbb/lineedit.c | 12 ++++++++++++
13 1 file changed, 12 insertions(+)
14
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)
20
21 static void add_match(char *matched)
22 {
23 + unsigned char *p = (unsigned char*)matched;
24 + while (*p) {
25 + /* ESC attack fix: drop any string with control chars */
26 + if (*p < ' '
27 + || (!ENABLE_UNICODE_SUPPORT && *p >= 0x7f)
28 + || (ENABLE_UNICODE_SUPPORT && *p == 0x7f)
29 + ) {
30 + free(matched);
31 + return;
32 + }
33 + p++;
34 + }
35 matches = xrealloc_vector(matches, 4, num_matches);
36 matches[num_matches] = matched;
37 num_matches++;
38 --
39 cgit v0.12
40