/[packages]/updates/5/irssi/current/SOURCES/CVE-2018-5208.patch
ViewVC logotype

Contents of /updates/5/irssi/current/SOURCES/CVE-2018-5208.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1192409 - (show annotations) (download)
Thu Jan 11 18:41:00 2018 UTC (8 months ago) by wally
File size: 3312 byte(s)
- add patches from Ubuntu to fix CVE-2018-520[5-8] (mga#22328)

1 Backport of:
2
3 From 2361d4b1e5d38701f35146219ceddd318ac4e645 Mon Sep 17 00:00:00 2001
4 From: ailin-nemui <ailin-nemui@users.noreply.github.com>
5 Date: Wed, 3 Jan 2018 15:35:18 +0100
6 Subject: [PATCH] rewrite completion code and check for direct match of
7 separator
8
9 ---
10 src/fe-common/core/completion.c | 18 ++++++++++++------
11 1 file changed, 12 insertions(+), 6 deletions(-)
12
13 Index: irssi-0.8.20/src/fe-common/core/completion.c
14 ===================================================================
15 --- irssi-0.8.20.orig/src/fe-common/core/completion.c 2018-01-08 14:45:15.432316177 -0500
16 +++ irssi-0.8.20/src/fe-common/core/completion.c 2018-01-08 14:51:48.108642699 -0500
17 @@ -37,8 +37,11 @@ static int last_want_space, last_line_po
18 #define isseparator_notspace(c) \
19 ((c) == ',')
20
21 +#define isseparator_space(c) \
22 + ((c) == ' ')
23 +
24 #define isseparator(c) \
25 - ((c) == ' ' || isseparator_notspace(c))
26 + (isseparator_space(c) || isseparator_notspace(c))
27
28 void chat_completion_init(void);
29 void chat_completion_deinit(void);
30 @@ -153,20 +156,23 @@ char *word_complete(WINDOW_REC *window,
31 word = NULL;
32 linestart = NULL;
33 } else {
34 + char* old_wordstart;
35 +
36 /* get the word we want to complete */
37 word = get_word_at(line, *pos, &wordstart);
38 + old_wordstart = wordstart;
39 +
40 startpos = (int) (wordstart-line);
41 wordlen = strlen(word);
42
43 - /* get the start of line until the word we're completing */
44 - if (isseparator(*line)) {
45 - /* empty space at the start of line */
46 - if (wordstart == line)
47 - wordstart += strlen(wordstart);
48 - } else {
49 - while (wordstart > line && isseparator(wordstart[-1]))
50 - wordstart--;
51 - }
52 + /* remove trailing spaces from linestart */
53 + while (wordstart > line && isseparator_space(wordstart[-1]))
54 + wordstart--;
55 +
56 + /* unless everything was spaces */
57 + if (old_wordstart > line && wordstart == line)
58 + wordstart = old_wordstart - 1;
59 +
60 linestart = g_strndup(line, (int) (wordstart-line));
61
62 /* completions usually add space after the word, that makes
63 @@ -175,19 +181,30 @@ char *word_complete(WINDOW_REC *window,
64 BUT if we start completion with "/msg "<tab>, we don't
65 want to complete the /msg word, but instead complete empty
66 word with /msg being in linestart. */
67 - if (!erase && *pos > 0 && line[*pos-1] == ' ' &&
68 - (*linestart == '\0' || wordstart[-1] != ' ')) {
69 + if (!erase && *pos > 0 && isseparator_space(line[*pos-1]) &&
70 + (*linestart == '\0' || !isseparator_space(wordstart[-1]))) {
71 char *old;
72
73 - old = linestart;
74 - linestart = *linestart == '\0' ?
75 - g_strdup(word) :
76 - g_strconcat(linestart, " ", word, NULL);
77 + old = linestart;
78 + /* we want to move word into linestart */
79 + if (*linestart == '\0') {
80 + linestart = g_strdup(word);
81 + } else {
82 + GString *str = g_string_new(linestart);
83 + if (old_wordstart[-1] != str->str[str->len - 1]) {
84 + /* do not accidentally duplicate the word separator */
85 + g_string_append_c(str, old_wordstart[-1]);
86 + }
87 + g_string_append(str, word);
88 + linestart = g_string_free(str, FALSE);
89 + }
90 g_free(old);
91
92 g_free(word);
93 word = g_strdup("");
94 - startpos = strlen(linestart)+1;
95 +
96 + startpos = *linestart == '\0' ? 0 :
97 + strlen(linestart)+1;
98 wordlen = 0;
99 }
100

  ViewVC Help
Powered by ViewVC 1.1.26