summaryrefslogtreecommitdiff
path: root/poky/meta/recipes-devtools/git/files/CVE-2023-29007.patch
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2023-06-15 01:50:09 +0300
committerPatrick Williams <patrick@stwcx.xyz>2023-06-15 01:56:06 +0300
commitc2858f16b31b065f92c42c838cf21d3592bc06e7 (patch)
tree58ffae2ee30976a58733f0ad4a3e6950b4258987 /poky/meta/recipes-devtools/git/files/CVE-2023-29007.patch
parent841583d6ba5918b60868b708ff0b89cf0409efa7 (diff)
downloadopenbmc-c2858f16b31b065f92c42c838cf21d3592bc06e7.tar.xz
subtree updatesdunfell
poky: a631bfc3a3..733d919af4: Alex Kiernan (2): pypi.bbclass: Set CVE_PRODUCT to PYPI_PACKAGE openssh: Move sshdgenkeys.service to sshd.socket Arturo Buzarra (1): run-postinsts: Set dependency for ldconfig to avoid boot issues Ashish Sharma (2): connman: Fix CVE-2023-28488 DoS in client.c golang: Fix CVE-2023-24539 Bruce Ashfield (5): linux-yocto/5.4: update to v5.4.238 linux-yocto/5.4: update to v5.4.240 linux-yocto/5.4: update to v5.4.241 linux-yocto/5.4: update to v5.4.242 linux-yocto/5.4: update to v5.4.243 Dmitry Baryshkov (1): linux-firmware: upgrade 20230210 -> 20230404 Hitendra Prajapati (2): git: fix CVE-2023-29007 git: fix CVE-2023-25652 Khem Raj (1): perf: Depend on native setuptools3 Marek Vasut (1): cpio: Fix wrong CRC with ASCII CRC for large files Martin Jansa (1): populate_sdk_ext.bbclass: set METADATA_REVISION with an DISTRO override Nikhil R (1): ffmpeg: Fix CVE-2022-48434 Peter Marko (1): libxml2: patch CVE-2023-28484 and CVE-2023-29469 Randolph Sapp (1): wic/bootimg-efi: if fixed-size is set then use that for mkdosfs Ranjitsinh Rathod (1): libbsd: Add correct license for all packages Shubham Kulkarni (1): go: Security fix for CVE-2023-24538 Siddharth (1): curl: ammend fix for CVE-2023-27534 to fix error when ssh is enabled Steve Sakoman (1): selftest: skip virgl test on ubuntu 22.10, fedora 37, and all rocky Thomas Roos (1): oeqa/utils/metadata.py: Fix running oe-selftest running with no distro set Vijay Anusuri (3): ghostscript: Fix CVE-2023-28879 xserver-xorg: Security fix CVE-2023-0494 and CVE-2023-1393 go: Security fix CVE-2023-24540 Vivek Kumbhar (1): freetype: fix CVE-2023-2004 integer overflowin in tt_hvadvance_adjust() in src/truetype/ttgxvar.c Yoann Congal (1): linux-yocto: Exclude 294 CVEs already fixed upstream meta-openembedded: 7007d14c25..116bfe8d5e: Alex Yao (1): lcov: Fix Perl Path Hitendra Prajapati (1): multipath-tools: CVE-2022-41973 Symlink attack multipathd operates insecurely Hugo SIMELIERE (3): openvpn: add CVE-2020-7224 and CVE-2020-27569 to allowlist openvpn: upgrade 2.4.9 -> 2.4.12 libmodbus: Fix CVE-2022-0367 Jack Mitchell (2): nss: backport fix for native build failure due to implicit casting with gcc13 nss: backport fix for native build failure due to dangling pointer with gcc13 Narpat Mali (1): nodejs: make 14.18.1 available but not default Valeria Petrov (1): apache2: upgrade 2.4.56 -> 2.4.57 Viktor Rosendahl (1): jsoncpp: Fix broken handling of escape characters Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8260e0168ea1ddec7ee03555e4f5653155e0ab45
Diffstat (limited to 'poky/meta/recipes-devtools/git/files/CVE-2023-29007.patch')
-rw-r--r--poky/meta/recipes-devtools/git/files/CVE-2023-29007.patch159
1 files changed, 159 insertions, 0 deletions
diff --git a/poky/meta/recipes-devtools/git/files/CVE-2023-29007.patch b/poky/meta/recipes-devtools/git/files/CVE-2023-29007.patch
new file mode 100644
index 0000000000..e166c01412
--- /dev/null
+++ b/poky/meta/recipes-devtools/git/files/CVE-2023-29007.patch
@@ -0,0 +1,159 @@
+From 057c07a7b1fae22fdeef26c243f4cfbe3afc90ce Mon Sep 17 00:00:00 2001
+From: Taylor Blau <me@ttaylorr.com>
+Date: Fri, 14 Apr 2023 11:46:59 -0400
+Subject: [PATCH] Merge branch 'tb/config-copy-or-rename-in-file-injection'
+
+Avoids issues with renaming or deleting sections with long lines, where
+configuration values may be interpreted as sections, leading to
+configuration injection. Addresses CVE-2023-29007.
+
+* tb/config-copy-or-rename-in-file-injection:
+ config.c: disallow overly-long lines in `copy_or_rename_section_in_file()`
+ config.c: avoid integer truncation in `copy_or_rename_section_in_file()`
+ config: avoid fixed-sized buffer when renaming/deleting a section
+ t1300: demonstrate failure when renaming sections with long lines
+
+Signed-off-by: Taylor Blau <me@ttaylorr.com>
+
+Upstream-Status: Backport [https://github.com/git/git/commit/528290f8c61222433a8cf02fb7cfffa8438432b4]
+CVE: CVE-2023-29007
+Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
+---
+ config.c | 36 +++++++++++++++++++++++++-----------
+ t/t1300-config.sh | 30 ++++++++++++++++++++++++++++++
+ 2 files changed, 55 insertions(+), 11 deletions(-)
+
+diff --git a/config.c b/config.c
+index e7052b3..676b687 100644
+--- a/config.c
++++ b/config.c
+@@ -2987,9 +2987,10 @@ void git_config_set_multivar(const char *key, const char *value,
+ multi_replace);
+ }
+
+-static int section_name_match (const char *buf, const char *name)
++static size_t section_name_match (const char *buf, const char *name)
+ {
+- int i = 0, j = 0, dot = 0;
++ size_t i = 0, j = 0;
++ int dot = 0;
+ if (buf[i] != '[')
+ return 0;
+ for (i = 1; buf[i] && buf[i] != ']'; i++) {
+@@ -3042,6 +3043,8 @@ static int section_name_is_ok(const char *name)
+ return 1;
+ }
+
++#define GIT_CONFIG_MAX_LINE_LEN (512 * 1024)
++
+ /* if new_name == NULL, the section is removed instead */
+ static int git_config_copy_or_rename_section_in_file(const char *config_filename,
+ const char *old_name,
+@@ -3051,11 +3054,12 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
+ char *filename_buf = NULL;
+ struct lock_file lock = LOCK_INIT;
+ int out_fd;
+- char buf[1024];
++ struct strbuf buf = STRBUF_INIT;
+ FILE *config_file = NULL;
+ struct stat st;
+ struct strbuf copystr = STRBUF_INIT;
+ struct config_store_data store;
++ uint32_t line_nr = 0;
+
+ memset(&store, 0, sizeof(store));
+
+@@ -3092,16 +3096,25 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
+ goto out;
+ }
+
+- while (fgets(buf, sizeof(buf), config_file)) {
+- int i;
+- int length;
++ while (!strbuf_getwholeline(&buf, config_file, '\n')) {
++ size_t i, length;
+ int is_section = 0;
+- char *output = buf;
+- for (i = 0; buf[i] && isspace(buf[i]); i++)
++ char *output = buf.buf;
++
++ line_nr++;
++
++ if (buf.len >= GIT_CONFIG_MAX_LINE_LEN) {
++ ret = error(_("refusing to work with overly long line "
++ "in '%s' on line %"PRIuMAX),
++ config_filename, (uintmax_t)line_nr);
++ goto out;
++ }
++
++ for (i = 0; buf.buf[i] && isspace(buf.buf[i]); i++)
+ ; /* do nothing */
+- if (buf[i] == '[') {
++ if (buf.buf[i] == '[') {
+ /* it's a section */
+- int offset;
++ size_t offset;
+ is_section = 1;
+
+ /*
+@@ -3118,7 +3131,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
+ strbuf_reset(&copystr);
+ }
+
+- offset = section_name_match(&buf[i], old_name);
++ offset = section_name_match(&buf.buf[i], old_name);
+ if (offset > 0) {
+ ret++;
+ if (new_name == NULL) {
+@@ -3193,6 +3206,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename
+ out_no_rollback:
+ free(filename_buf);
+ config_store_data_clear(&store);
++ strbuf_release(&buf);
+ return ret;
+ }
+
+diff --git a/t/t1300-config.sh b/t/t1300-config.sh
+index 983a0a1..9b67f6b 100755
+--- a/t/t1300-config.sh
++++ b/t/t1300-config.sh
+@@ -616,6 +616,36 @@ test_expect_success 'renaming to bogus section is rejected' '
+ test_must_fail git config --rename-section branch.zwei "bogus name"
+ '
+
++test_expect_success 'renaming a section with a long line' '
++ {
++ printf "[b]\\n" &&
++ printf " c = d %1024s [a] e = f\\n" " " &&
++ printf "[a] g = h\\n"
++ } >y &&
++ git config -f y --rename-section a xyz &&
++ test_must_fail git config -f y b.e
++'
++
++test_expect_success 'renaming an embedded section with a long line' '
++ {
++ printf "[b]\\n" &&
++ printf " c = d %1024s [a] [foo] e = f\\n" " " &&
++ printf "[a] g = h\\n"
++ } >y &&
++ git config -f y --rename-section a xyz &&
++ test_must_fail git config -f y foo.e
++'
++
++test_expect_success 'renaming a section with an overly-long line' '
++ {
++ printf "[b]\\n" &&
++ printf " c = d %525000s e" " " &&
++ printf "[a] g = h\\n"
++ } >y &&
++ test_must_fail git config -f y --rename-section a xyz 2>err &&
++ test_i18ngrep "refusing to work with overly long line in .y. on line 2" err
++'
++
+ cat >> .git/config << EOF
+ [branch "zwei"] a = 1 [branch "vier"]
+ EOF
+--
+2.25.1
+