diff options
author | Minjae Kim <flowergom@gmail.com> | 2021-12-17 20:55:05 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-12-30 16:59:16 +0000 |
commit | 9564dc31cb906f2c80746858eb9977b43886e723 (patch) | |
tree | 7ada810515c84e6b64f8a0c73bd14e17dd4b54d7 | |
parent | bd0708041517517021110a5dd328dede123c1768 (diff) | |
download | poky-9564dc31cb906f2c80746858eb9977b43886e723.tar.gz |
vim: fix CVE-2021-4069
Use After Free in vim/vim
Upstream-Status: Backport [https://github.com/vim/vim/commit/e031fe90cf2e375ce861ff5e5e281e4ad229ebb9]
CVE: CVE-2021-4069
(From OE-Core rev: 9db3b4ac4018bcaedb995bc77a9e675c2bca468f)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/recipes-support/vim/files/CVE-2021-4069.patch | 43 | ||||
-rw-r--r-- | meta/recipes-support/vim/vim.inc | 1 |
2 files changed, 44 insertions, 0 deletions
diff --git a/meta/recipes-support/vim/files/CVE-2021-4069.patch b/meta/recipes-support/vim/files/CVE-2021-4069.patch new file mode 100644 index 0000000000..6a67281907 --- /dev/null +++ b/meta/recipes-support/vim/files/CVE-2021-4069.patch | |||
@@ -0,0 +1,43 @@ | |||
1 | From cd2422ee2dab3f33b2dbd1271e17cdaf8762b6d1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Minjae Kim <flowergom@gmail.com> | ||
3 | Date: Fri, 17 Dec 2021 20:32:02 -0800 | ||
4 | Subject: [PATCH] using freed memory in open command | ||
5 | |||
6 | Problem: Using freed memory in open command. | ||
7 | Solution: Make a copy of the current line. | ||
8 | |||
9 | Upstream-Status: Backported [https://github.com/vim/vim/commit/e031fe90cf2e375ce861ff5e5e281e4ad229ebb9] | ||
10 | CVE: CVE-2021-4069 | ||
11 | Signed-off-by: Minjae Kim <flowergom@gmail.com> | ||
12 | --- | ||
13 | src/ex_docmd.c | 10 +++++++--- | ||
14 | 1 file changed, 7 insertions(+), 3 deletions(-) | ||
15 | |||
16 | diff --git a/src/ex_docmd.c b/src/ex_docmd.c | ||
17 | index 59e245bee..ccd9e8bed 100644 | ||
18 | --- a/src/ex_docmd.c | ||
19 | +++ b/src/ex_docmd.c | ||
20 | @@ -6029,13 +6029,17 @@ ex_open(exarg_T *eap) | ||
21 | regmatch.regprog = vim_regcomp(eap->arg, p_magic ? RE_MAGIC : 0); | ||
22 | if (regmatch.regprog != NULL) | ||
23 | { | ||
24 | + // make a copy of the line, when searching for a mark it might be | ||
25 | + // flushed | ||
26 | + char_u *line = vim_strsave(ml_get_curline()); | ||
27 | + | ||
28 | regmatch.rm_ic = p_ic; | ||
29 | - p = ml_get_curline(); | ||
30 | - if (vim_regexec(®match, p, (colnr_T)0)) | ||
31 | - curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - p); | ||
32 | + if (vim_regexec(®match, line, (colnr_T)0)) | ||
33 | + curwin->w_cursor.col = (colnr_T)(regmatch.startp[0] - line); | ||
34 | else | ||
35 | emsg(_(e_nomatch)); | ||
36 | vim_regfree(regmatch.regprog); | ||
37 | + vim_free(line); | ||
38 | } | ||
39 | // Move to the NUL, ignore any other arguments. | ||
40 | eap->arg += STRLEN(eap->arg); | ||
41 | -- | ||
42 | 2.25.1 | ||
43 | |||
diff --git a/meta/recipes-support/vim/vim.inc b/meta/recipes-support/vim/vim.inc index 11fed67527..51a6861325 100644 --- a/meta/recipes-support/vim/vim.inc +++ b/meta/recipes-support/vim/vim.inc | |||
@@ -26,6 +26,7 @@ SRC_URI = "git://github.com/vim/vim.git;branch=master;protocol=https \ | |||
26 | file://0001-patch-8.2.3581-reading-character-past-end-of-line.patch \ | 26 | file://0001-patch-8.2.3581-reading-character-past-end-of-line.patch \ |
27 | file://0002-patch-8.2.3582-reading-uninitialized-memory-when-giv.patch \ | 27 | file://0002-patch-8.2.3582-reading-uninitialized-memory-when-giv.patch \ |
28 | file://0002-patch-8.2.3611-crash-when-using-CTRL-W-f-without-fin.patch \ | 28 | file://0002-patch-8.2.3611-crash-when-using-CTRL-W-f-without-fin.patch \ |
29 | file://CVE-2021-4069.patch \ | ||
29 | " | 30 | " |
30 | 31 | ||
31 | SRCREV = "98056533b96b6b5d8849641de93185dd7bcadc44" | 32 | SRCREV = "98056533b96b6b5d8849641de93185dd7bcadc44" |