summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/recipes-support/libgit2/libgit2/CVE-2024-24575.patch56
-rw-r--r--meta/recipes-support/libgit2/libgit2/CVE-2024-24577.patch52
-rw-r--r--meta/recipes-support/libgit2/libgit2_1.4.5.bb5
3 files changed, 112 insertions, 1 deletions
diff --git a/meta/recipes-support/libgit2/libgit2/CVE-2024-24575.patch b/meta/recipes-support/libgit2/libgit2/CVE-2024-24575.patch
new file mode 100644
index 0000000000..d3957ac5d0
--- /dev/null
+++ b/meta/recipes-support/libgit2/libgit2/CVE-2024-24575.patch
@@ -0,0 +1,56 @@
1From c9d31b711e8906cf248566f43142f20b03e20cbf Mon Sep 17 00:00:00 2001
2From: Edward Thomson <ethomson@edwardthomson.com>
3Date: Fri, 17 Nov 2023 16:54:47 +0000
4Subject: [PATCH] revparse: fix parsing bug for trailing `@`
5
6When parsing a revspec that ends with a trailing `@`, explicitly stop
7parsing. Introduce a sentinel variable to explicitly stop parsing.
8
9Prior to this, we would set `spec` to `HEAD`, but were looping on the
10value of `spec[pos]`, so we would continue walking the (new) `spec`
11at offset `pos`, looking for a NUL. This is obviously an out-of-bounds
12read.
13
14Credit to Michael Rodler (@f0rki) and Amazon AWS Security.
15
16CVE: CVE-2024-24575
17
18Upstream-Status: Backport [https://github.com/libgit2/libgit2/commit/c9d31b711e8906cf248566f43142f20b03e20cbf]
19
20Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
21---
22 src/revparse.c | 5 ++++-
23 1 file changed, 4 insertions(+), 1 deletion(-)
24
25diff --git a/src/revparse.c b/src/revparse.c
26index 9bc28e9fc..d3bbe840b 100644
27--- a/src/revparse.c
28+++ b/src/revparse.c
29@@ -685,6 +685,7 @@ static int revparse(
30 git_object *base_rev = NULL;
31
32 bool should_return_reference = true;
33+ bool parsed = false;
34
35 GIT_ASSERT_ARG(object_out);
36 GIT_ASSERT_ARG(reference_out);
37@@ -694,7 +695,7 @@ static int revparse(
38 *object_out = NULL;
39 *reference_out = NULL;
40
41- while (spec[pos]) {
42+ while (!parsed && spec[pos]) {
43 switch (spec[pos]) {
44 case '^':
45 should_return_reference = false;
46@@ -801,6 +802,8 @@ static int revparse(
47 break;
48 } else if (spec[pos+1] == '\0') {
49 spec = "HEAD";
50+ identifier_len = 4;
51+ parsed = true;
52 break;
53 }
54 /* fall through */
55--
562.40.0
diff --git a/meta/recipes-support/libgit2/libgit2/CVE-2024-24577.patch b/meta/recipes-support/libgit2/libgit2/CVE-2024-24577.patch
new file mode 100644
index 0000000000..3469f9d099
--- /dev/null
+++ b/meta/recipes-support/libgit2/libgit2/CVE-2024-24577.patch
@@ -0,0 +1,52 @@
1From eb4c1716cd92bf56f2770653a915d5fc01eab8f3 Mon Sep 17 00:00:00 2001
2From: Edward Thomson <ethomson@edwardthomson.com>
3Date: Sat, 16 Dec 2023 11:19:07 +0000
4Subject: [PATCH] index: correct index has_dir_name check
5
6`has_dir_name` is used to check for directory/file collisions,
7and attempts to determine whether the index contains a file with
8a directory name that is a proper subset of the new index entry
9that we're trying to add.
10
11To determine directory name, the function would walk the path string
12backwards to identify a `/`, stopping at the end of the string. However,
13the function assumed that the strings did not start with a `/`. If the
14paths contain only a single `/` at the beginning of the string, then the
15function would continue the loop, erroneously, when they should have
16stopped at the first character.
17
18Correct the order of the tests to terminate properly.
19
20Credit to Michael Rodler (@f0rki) and Amazon AWS Security.
21
22CVE: CVE-2024-24577
23
24Upstream-Status: Backport [https://github.com/libgit2/libgit2/commit/eb4c1716cd92bf56f2770653a915d5fc01eab8f3]
25
26Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
27---
28 src/index.c | 7 +++++--
29 1 file changed, 5 insertions(+), 2 deletions(-)
30
31diff --git a/src/index.c b/src/index.c
32index aa97c6421..e8ff82e1a 100644
33--- a/src/index.c
34+++ b/src/index.c
35@@ -1148,10 +1148,13 @@ static int has_dir_name(git_index *index,
36 size_t len, pos;
37
38 for (;;) {
39- if (*--slash == '/')
40- break;
41+ slash--;
42+
43 if (slash <= entry->path)
44 return 0;
45+
46+ if (*slash == '/')
47+ break;
48 }
49 len = slash - name;
50
51--
522.40.0
diff --git a/meta/recipes-support/libgit2/libgit2_1.4.5.bb b/meta/recipes-support/libgit2/libgit2_1.4.5.bb
index aadfe4ad02..ad8b9a536a 100644
--- a/meta/recipes-support/libgit2/libgit2_1.4.5.bb
+++ b/meta/recipes-support/libgit2/libgit2_1.4.5.bb
@@ -5,7 +5,10 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=e5a9227de4cb6afb5d35ed7b0fdf480d"
5 5
6DEPENDS = "curl openssl zlib libssh2 libgcrypt libpcre2" 6DEPENDS = "curl openssl zlib libssh2 libgcrypt libpcre2"
7 7
8SRC_URI = "git://github.com/libgit2/libgit2.git;branch=maint/v1.4;protocol=https" 8SRC_URI = "git://github.com/libgit2/libgit2.git;branch=maint/v1.4;protocol=https \
9 file://CVE-2024-24575.patch \
10 file://CVE-2024-24577.patch \
11 "
9SRCREV = "cd6f679af401eda1f172402006ef8265f8bd58ea" 12SRCREV = "cd6f679af401eda1f172402006ef8265f8bd58ea"
10 13
11S = "${WORKDIR}/git" 14S = "${WORKDIR}/git"