aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-support
diff options
context:
space:
mode:
Diffstat (limited to 'meta-oe/recipes-support')
-rw-r--r--meta-oe/recipes-support/c-ares/c-ares/CVE-2022-4904.patch66
-rw-r--r--meta-oe/recipes-support/c-ares/c-ares/CVE-2023-31130.patch328
-rw-r--r--meta-oe/recipes-support/c-ares/c-ares/CVE-2023-31147.patch717
-rw-r--r--meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch85
-rw-r--r--meta-oe/recipes-support/c-ares/c-ares/CVE-2024-25629.patch34
-rw-r--r--meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb12
-rw-r--r--meta-oe/recipes-support/exiv2/exiv2_0.27.3.bb2
-rw-r--r--meta-oe/recipes-support/freerdp/freerdp/CVE-2022-39316.patch53
-rw-r--r--meta-oe/recipes-support/freerdp/freerdp/CVE-2022-39318-39319.patch41
-rw-r--r--meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb2
-rw-r--r--meta-oe/recipes-support/glog/glog_0.5.0.bb2
-rw-r--r--meta-oe/recipes-support/gnulib/gnulib_2018-12-18.bb (renamed from meta-oe/recipes-support/gnulib/gnulib_2018-03-07.03.bb)0
-rw-r--r--meta-oe/recipes-support/hdf5/files/CVE-2021-37501.patch37
-rw-r--r--meta-oe/recipes-support/hdf5/hdf5_1.8.21.bb1
-rw-r--r--meta-oe/recipes-support/iniparser/iniparser/CVE-2023-33461.patch51
-rw-r--r--meta-oe/recipes-support/iniparser/iniparser_4.1.bb4
-rw-r--r--meta-oe/recipes-support/libbytesize/libbytesize_2.6.bb2
-rw-r--r--meta-oe/recipes-support/libeigen/libeigen_3.4.0.bb2
-rw-r--r--meta-oe/recipes-support/libiio/libiio_git.bb2
-rw-r--r--meta-oe/recipes-support/libmxml/libmxml_3.3.bb2
-rw-r--r--meta-oe/recipes-support/libssh/libssh/0001-config-Move-common-parser-functions-to-config_parser.patch464
-rw-r--r--meta-oe/recipes-support/libssh/libssh/001_CVE-2023-6004.patch30
-rw-r--r--meta-oe/recipes-support/libssh/libssh/002_CVE-2023-6004.patch83
-rw-r--r--meta-oe/recipes-support/libssh/libssh/003_CVE-2023-6004.patch117
-rw-r--r--meta-oe/recipes-support/libssh/libssh/004_CVE-2023-6004.patch57
-rw-r--r--meta-oe/recipes-support/libssh/libssh/005_CVE-2023-6004.patch142
-rw-r--r--meta-oe/recipes-support/libssh/libssh/006_CVE-2023-6004.patch117
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2020-16135.patch44
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-1.patch385
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-2.patch126
-rw-r--r--meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-3.patch47
-rw-r--r--meta-oe/recipes-support/libssh/libssh_0.8.9.bb14
-rw-r--r--meta-oe/recipes-support/multipath-tools/files/CVE-2022-41974.patch164
-rw-r--r--meta-oe/recipes-support/multipath-tools/multipath-tools_0.8.4.bb3
-rw-r--r--meta-oe/recipes-support/nss/nss/0001-Bug-1780432-CVE-2023-5388-Timing-attack-against-RSA-.patch681
-rw-r--r--meta-oe/recipes-support/nss/nss/0001-Bug-1867408-add-a-defensive-check-for-large-ssl_DefS.patch40
-rw-r--r--meta-oe/recipes-support/nss/nss/0001-nss-fix-support-cross-compiling.patch7
-rw-r--r--meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch102
-rw-r--r--meta-oe/recipes-support/nss/nss_3.74.bb3
-rw-r--r--meta-oe/recipes-support/opencv/opencv/CVE-2023-2617.patch88
-rw-r--r--meta-oe/recipes-support/opencv/opencv/CVE-2023-2618.patch32
-rw-r--r--meta-oe/recipes-support/opencv/opencv_4.5.5.bb32
-rw-r--r--meta-oe/recipes-support/openldap/openldap/0001-ITS-10094-libldap-OpenSSL-fix-setting-ciphersuites.patch69
-rw-r--r--meta-oe/recipes-support/openldap/openldap/0001-ldif-filter-fix-parallel-build-failure.patch32
-rw-r--r--meta-oe/recipes-support/openldap/openldap/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch33
-rw-r--r--meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch54
-rw-r--r--meta-oe/recipes-support/openldap/openldap_2.5.16.bb (renamed from meta-oe/recipes-support/openldap/openldap_2.5.12.bb)6
-rw-r--r--meta-oe/recipes-support/opensc/files/CVE-2023-2977.patch53
-rw-r--r--meta-oe/recipes-support/opensc/opensc/CVE-2023-40660.patch55
-rw-r--r--meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-1.patch47
-rw-r--r--meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-2.patch32
-rw-r--r--meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-3.patch31
-rw-r--r--meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-4.patch28
-rw-r--r--meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-5.patch30
-rw-r--r--meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-6.patch30
-rw-r--r--meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-7.patch40
-rw-r--r--meta-oe/recipes-support/opensc/opensc_0.22.0.bb14
-rw-r--r--meta-oe/recipes-support/poppler/poppler/0001-JBIG2Stream-Fix-crash-on-broken-file.patch41
-rw-r--r--meta-oe/recipes-support/poppler/poppler/CVE-2023-34872.patch46
-rw-r--r--meta-oe/recipes-support/poppler/poppler_22.04.0.bb2
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0001.patch65
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0002.patch150
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0003.patch77
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0004.patch37
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0005.patch211
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0006.patch180
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0007.patch81
-rw-r--r--meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0008.patch45
-rw-r--r--meta-oe/recipes-support/syslog-ng/syslog-ng_3.36.1.bb8
-rw-r--r--meta-oe/recipes-support/unixodbc/files/CVE-2024-1013.patch53
-rw-r--r--meta-oe/recipes-support/unixodbc/unixodbc_2.3.9.bb1
-rw-r--r--meta-oe/recipes-support/uriparser/uriparser_0.9.8.bb (renamed from meta-oe/recipes-support/uriparser/uriparser_0.9.6.bb)2
-rw-r--r--meta-oe/recipes-support/yaml-cpp/yaml-cpp/0001-Fix-CMake-export-files-1077.patch117
-rw-r--r--meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb1
74 files changed, 5742 insertions, 150 deletions
diff --git a/meta-oe/recipes-support/c-ares/c-ares/CVE-2022-4904.patch b/meta-oe/recipes-support/c-ares/c-ares/CVE-2022-4904.patch
new file mode 100644
index 0000000000..328075ca64
--- /dev/null
+++ b/meta-oe/recipes-support/c-ares/c-ares/CVE-2022-4904.patch
@@ -0,0 +1,66 @@
+From 9903253c347f9e0bffd285ae3829aef251cc852d Mon Sep 17 00:00:00 2001
+From: hopper-vul <118949689+hopper-vul@users.noreply.github.com>
+Date: Wed, 18 Jan 2023 22:14:26 +0800
+Subject: [PATCH] Add str len check in config_sortlist to avoid stack overflow
+ (#497)
+
+In ares_set_sortlist, it calls config_sortlist(..., sortstr) to parse
+the input str and initialize a sortlist configuration.
+
+However, ares_set_sortlist has not any checks about the validity of the input str.
+It is very easy to create an arbitrary length stack overflow with the unchecked
+`memcpy(ipbuf, str, q-str);` and `memcpy(ipbufpfx, str, q-str);`
+statements in the config_sortlist call, which could potentially cause severe
+security impact in practical programs.
+
+This commit add necessary check for `ipbuf` and `ipbufpfx` which avoid the
+potential stack overflows.
+
+fixes #496
+
+Fix By: @hopper-vul
+
+CVE: CVE-2022-4904
+Upstream-Status: Backport [https://github.com/c-ares/c-ares/commit/9903253c347f9e0bffd285ae3829aef251cc852d]
+
+Signed-off-by: Peter Marko <peter.marko@siemens.com>
+---
+ src/lib/ares_init.c | 4 ++++
+ test/ares-test-init.cc | 2 ++
+ 2 files changed, 6 insertions(+)
+
+diff --git a/src/lib/ares_init.c b/src/lib/ares_init.c
+index 51668a5c..3f9cec65 100644
+--- a/src/lib/ares_init.c
++++ b/src/lib/ares_init.c
+@@ -1913,6 +1913,8 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
+ q = str;
+ while (*q && *q != '/' && *q != ';' && !ISSPACE(*q))
+ q++;
++ if (q-str >= 16)
++ return ARES_EBADSTR;
+ memcpy(ipbuf, str, q-str);
+ ipbuf[q-str] = '\0';
+ /* Find the prefix */
+@@ -1921,6 +1923,8 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
+ const char *str2 = q+1;
+ while (*q && *q != ';' && !ISSPACE(*q))
+ q++;
++ if (q-str >= 32)
++ return ARES_EBADSTR;
+ memcpy(ipbufpfx, str, q-str);
+ ipbufpfx[q-str] = '\0';
+ str = str2;
+diff --git a/test/ares-test-init.cc b/test/ares-test-init.cc
+index 63c6a228..ee845181 100644
+--- a/test/ares-test-init.cc
++++ b/test/ares-test-init.cc
+@@ -275,6 +275,8 @@ TEST_F(DefaultChannelTest, SetAddresses) {
+
+ TEST_F(DefaultChannelTest, SetSortlistFailures) {
+ EXPECT_EQ(ARES_ENODATA, ares_set_sortlist(nullptr, "1.2.3.4"));
++ EXPECT_EQ(ARES_EBADSTR, ares_set_sortlist(channel_, "111.111.111.111*/16"));
++ EXPECT_EQ(ARES_EBADSTR, ares_set_sortlist(channel_, "111.111.111.111/255.255.255.240*"));
+ EXPECT_EQ(ARES_SUCCESS, ares_set_sortlist(channel_, "xyzzy ; lwk"));
+ EXPECT_EQ(ARES_SUCCESS, ares_set_sortlist(channel_, "xyzzy ; 0x123"));
+ }
diff --git a/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-31130.patch b/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-31130.patch
new file mode 100644
index 0000000000..3e507f7cda
--- /dev/null
+++ b/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-31130.patch
@@ -0,0 +1,328 @@
+From f22cc01039b6473b736d3bf438f56a2654cdf2b2 Mon Sep 17 00:00:00 2001
+From: Brad House <brad@brad-house.com>
+Date: Mon, 22 May 2023 06:51:34 -0400
+Subject: [PATCH] Merge pull request from GHSA-x6mf-cxr9-8q6v
+
+* Merged latest OpenBSD changes for inet_net_pton_ipv6() into c-ares.
+* Always use our own IP conversion functions now, do not delegate to OS
+ so we can have consistency in testing and fuzzing.
+* Removed bogus test cases that never should have passed.
+* Add new test case for crash bug found.
+
+Fix By: Brad House (@bradh352)
+
+Upstream-Status: Backport [https://github.com/c-ares/c-ares/commit/f22cc01039b6473b736d3bf438f56a2654cdf2b2.patch]
+CVE: CVE-2023-31130
+Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
+---
+ src/lib/inet_net_pton.c | 155 ++++++++++++++++++++-----------------
+ test/ares-test-internal.cc | 7 +-
+ 2 files changed, 86 insertions(+), 76 deletions(-)
+
+diff --git a/src/lib/inet_net_pton.c b/src/lib/inet_net_pton.c
+index 840de50..fc50425 100644
+--- a/src/lib/inet_net_pton.c
++++ b/src/lib/inet_net_pton.c
+@@ -1,19 +1,20 @@
+
+ /*
+- * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
++ * Copyright (c) 2012 by Gilles Chehade <gilles@openbsd.org>
+ * Copyright (c) 1996,1999 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+- * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
+- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR
+- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
+- * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
++ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
++ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
++ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
++ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
++ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
++ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
++ * SOFTWARE.
+ */
+
+ #include "ares_setup.h"
+@@ -35,9 +36,6 @@
+
+ const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
+
+-
+-#ifndef HAVE_INET_NET_PTON
+-
+ /*
+ * static int
+ * inet_net_pton_ipv4(src, dst, size)
+@@ -60,7 +58,7 @@ const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+ * Paul Vixie (ISC), June 1996
+ */
+ static int
+-inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
++ares_inet_net_pton_ipv4(const char *src, unsigned char *dst, size_t size)
+ {
+ static const char xdigits[] = "0123456789abcdef";
+ static const char digits[] = "0123456789";
+@@ -261,19 +259,14 @@ getv4(const char *src, unsigned char *dst, int *bitsp)
+ }
+
+ static int
+-inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
++ares_inet_pton6(const char *src, unsigned char *dst)
+ {
+ static const char xdigits_l[] = "0123456789abcdef",
+- xdigits_u[] = "0123456789ABCDEF";
++ xdigits_u[] = "0123456789ABCDEF";
+ unsigned char tmp[NS_IN6ADDRSZ], *tp, *endp, *colonp;
+ const char *xdigits, *curtok;
+- int ch, saw_xdigit;
++ int ch, saw_xdigit, count_xdigit;
+ unsigned int val;
+- int digits;
+- int bits;
+- size_t bytes;
+- int words;
+- int ipv4;
+
+ memset((tp = tmp), '\0', NS_IN6ADDRSZ);
+ endp = tp + NS_IN6ADDRSZ;
+@@ -283,22 +276,22 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
+ if (*++src != ':')
+ goto enoent;
+ curtok = src;
+- saw_xdigit = 0;
++ saw_xdigit = count_xdigit = 0;
+ val = 0;
+- digits = 0;
+- bits = -1;
+- ipv4 = 0;
+ while ((ch = *src++) != '\0') {
+ const char *pch;
+
+ if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
+ pch = strchr((xdigits = xdigits_u), ch);
+ if (pch != NULL) {
++ if (count_xdigit >= 4)
++ goto enoent;
+ val <<= 4;
+- val |= aresx_sztoui(pch - xdigits);
+- if (++digits > 4)
++ val |= (pch - xdigits);
++ if (val > 0xffff)
+ goto enoent;
+ saw_xdigit = 1;
++ count_xdigit++;
+ continue;
+ }
+ if (ch == ':') {
+@@ -308,78 +301,107 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
+ goto enoent;
+ colonp = tp;
+ continue;
+- } else if (*src == '\0')
++ } else if (*src == '\0') {
+ goto enoent;
++ }
+ if (tp + NS_INT16SZ > endp)
+- return (0);
+- *tp++ = (unsigned char)((val >> 8) & 0xff);
+- *tp++ = (unsigned char)(val & 0xff);
++ goto enoent;
++ *tp++ = (unsigned char) (val >> 8) & 0xff;
++ *tp++ = (unsigned char) val & 0xff;
+ saw_xdigit = 0;
+- digits = 0;
++ count_xdigit = 0;
+ val = 0;
+ continue;
+ }
+ if (ch == '.' && ((tp + NS_INADDRSZ) <= endp) &&
+- getv4(curtok, tp, &bits) > 0) {
+- tp += NS_INADDRSZ;
++ ares_inet_net_pton_ipv4(curtok, tp, INADDRSZ) > 0) {
++ tp += INADDRSZ;
+ saw_xdigit = 0;
+- ipv4 = 1;
++ count_xdigit = 0;
+ break; /* '\0' was seen by inet_pton4(). */
+ }
+- if (ch == '/' && getbits(src, &bits) > 0)
+- break;
+ goto enoent;
+ }
+ if (saw_xdigit) {
+ if (tp + NS_INT16SZ > endp)
+ goto enoent;
+- *tp++ = (unsigned char)((val >> 8) & 0xff);
+- *tp++ = (unsigned char)(val & 0xff);
++ *tp++ = (unsigned char) (val >> 8) & 0xff;
++ *tp++ = (unsigned char) val & 0xff;
+ }
+- if (bits == -1)
+- bits = 128;
+-
+- words = (bits + 15) / 16;
+- if (words < 2)
+- words = 2;
+- if (ipv4)
+- words = 8;
+- endp = tmp + 2 * words;
+-
+ if (colonp != NULL) {
+ /*
+ * Since some memmove()'s erroneously fail to handle
+ * overlapping regions, we'll do the shift by hand.
+ */
+- const ares_ssize_t n = tp - colonp;
+- ares_ssize_t i;
++ const int n = tp - colonp;
++ int i;
+
+ if (tp == endp)
+ goto enoent;
+ for (i = 1; i <= n; i++) {
+- *(endp - i) = *(colonp + n - i);
+- *(colonp + n - i) = 0;
++ endp[- i] = colonp[n - i];
++ colonp[n - i] = 0;
+ }
+ tp = endp;
+ }
+ if (tp != endp)
+ goto enoent;
+
+- bytes = (bits + 7) / 8;
+- if (bytes > size)
+- goto emsgsize;
+- memcpy(dst, tmp, bytes);
+- return (bits);
++ memcpy(dst, tmp, NS_IN6ADDRSZ);
++ return (1);
+
+- enoent:
++enoent:
+ SET_ERRNO(ENOENT);
+ return (-1);
+
+- emsgsize:
++emsgsize:
+ SET_ERRNO(EMSGSIZE);
+ return (-1);
+ }
+
++static int
++ares_inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
++{
++ struct ares_in6_addr in6;
++ int ret;
++ int bits;
++ size_t bytes;
++ char buf[INET6_ADDRSTRLEN + sizeof("/128")];
++ char *sep;
++ const char *errstr;
++
++ if (strlen(src) >= sizeof buf) {
++ SET_ERRNO(EMSGSIZE);
++ return (-1);
++ }
++ strncpy(buf, src, sizeof buf);
++
++ sep = strchr(buf, '/');
++ if (sep != NULL)
++ *sep++ = '\0';
++
++ ret = ares_inet_pton6(buf, (unsigned char *)&in6);
++ if (ret != 1)
++ return (-1);
++
++ if (sep == NULL)
++ bits = 128;
++ else {
++ if (!getbits(sep, &bits)) {
++ SET_ERRNO(ENOENT);
++ return (-1);
++ }
++ }
++
++ bytes = (bits + 7) / 8;
++ if (bytes > size) {
++ SET_ERRNO(EMSGSIZE);
++ return (-1);
++ }
++ memcpy(dst, &in6, bytes);
++ return (bits);
++}
++
+ /*
+ * int
+ * inet_net_pton(af, src, dst, size)
+@@ -403,18 +425,15 @@ ares_inet_net_pton(int af, const char *src, void *dst, size_t size)
+ {
+ switch (af) {
+ case AF_INET:
+- return (inet_net_pton_ipv4(src, dst, size));
++ return (ares_inet_net_pton_ipv4(src, dst, size));
+ case AF_INET6:
+- return (inet_net_pton_ipv6(src, dst, size));
++ return (ares_inet_net_pton_ipv6(src, dst, size));
+ default:
+ SET_ERRNO(EAFNOSUPPORT);
+ return (-1);
+ }
+ }
+
+-#endif /* HAVE_INET_NET_PTON */
+-
+-#ifndef HAVE_INET_PTON
+ int ares_inet_pton(int af, const char *src, void *dst)
+ {
+ int result;
+@@ -434,11 +453,3 @@ int ares_inet_pton(int af, const char *src, void *dst)
+ return 0;
+ return (result > -1 ? 1 : -1);
+ }
+-#else /* HAVE_INET_PTON */
+-int ares_inet_pton(int af, const char *src, void *dst)
+-{
+- /* just relay this to the underlying function */
+- return inet_pton(af, src, dst);
+-}
+-
+-#endif
+diff --git a/test/ares-test-internal.cc b/test/ares-test-internal.cc
+index 96d4ede..161f0a5 100644
+--- a/test/ares-test-internal.cc
++++ b/test/ares-test-internal.cc
+@@ -81,6 +81,7 @@ TEST_F(LibraryTest, InetPtoN) {
+ EXPECT_EQ(0, ares_inet_net_pton(AF_INET6, "12:34::ff/0", &a6, sizeof(a6)));
+ EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "12:34::ffff:0.2", &a6, sizeof(a6)));
+ EXPECT_EQ(16 * 8, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234", &a6, sizeof(a6)));
++ EXPECT_EQ(2, ares_inet_net_pton(AF_INET6, "0::00:00:00/2", &a6, sizeof(a6)));
+
+ // Various malformed versions
+ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET, "", &a4, sizeof(a4)));
+@@ -118,11 +119,9 @@ TEST_F(LibraryTest, InetPtoN) {
+ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, ":1234:1234:1234:1234:1234:1234:1234:1234", &a6, sizeof(a6)));
+ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, ":1234:1234:1234:1234:1234:1234:1234:1234:", &a6, sizeof(a6)));
+ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:5678", &a6, sizeof(a6)));
+- // TODO(drysdale): check whether the next two tests should give -1.
+- EXPECT_EQ(0, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:5678:5678", &a6, sizeof(a6)));
+- EXPECT_EQ(0, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:5678:5678:5678", &a6, sizeof(a6)));
++ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:5678:5678", &a6, sizeof(a6)));
++ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "1234:1234:1234:1234:1234:1234:1234:1234:5678:5678:5678", &a6, sizeof(a6)));
+ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:257.2.3.4", &a6, sizeof(a6)));
+- EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:002.2.3.4", &a6, sizeof(a6)));
+ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.4.5.6", &a6, sizeof(a6)));
+ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.4.5", &a6, sizeof(a6)));
+ EXPECT_EQ(-1, ares_inet_net_pton(AF_INET6, "12:34::ffff:1.2.3.z", &a6, sizeof(a6)));
+--
+2.25.1
+
diff --git a/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-31147.patch b/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-31147.patch
new file mode 100644
index 0000000000..bbd6aa0aec
--- /dev/null
+++ b/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-31147.patch
@@ -0,0 +1,717 @@
+From c543406f44fa070ea101d4d4b173c2c88af0c2a5 Mon Sep 17 00:00:00 2001
+From: Brad House <brad@brad-house.com>
+Date: Mon, 22 May 2023 06:51:06 -0400
+Subject: [PATCH] Merge pull request from GHSA-8r8p-23f3-64c2
+
+* segment random number generation into own file
+
+* abstract random code to make it more modular so we can have multiple backends
+
+* rand: add support for arc4random_buf() and also direct CARES_RANDOM_FILE reading
+
+* autotools: fix detection of arc4random_buf
+
+* rework initial rc4 seed for PRNG as last fallback
+
+* rc4: more proper implementation, simplified for clarity
+
+* clarifications
+
+CVE: CVE-2023-31147
+Upstream-Status: Backport [https://github.com/c-ares/c-ares/commit/823df3b989e59465d17b0a2eb1239a5fc048b4e5]
+
+Signed-off-by: Peter Marko <peter.marko@siemens.com>
+---
+ CMakeLists.txt | 2 +
+ configure.ac | 1 +
+ m4/cares-functions.m4 | 85 +++++++++++
+ src/lib/Makefile.inc | 1 +
+ src/lib/ares_config.h.cmake | 3 +
+ src/lib/ares_destroy.c | 3 +
+ src/lib/ares_init.c | 82 ++---------
+ src/lib/ares_private.h | 19 ++-
+ src/lib/ares_query.c | 36 +----
+ src/lib/ares_rand.c | 274 ++++++++++++++++++++++++++++++++++++
+ 10 files changed, 387 insertions(+), 119 deletions(-)
+ create mode 100644 src/lib/ares_rand.c
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 194485a..1fb9af5 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -386,6 +386,8 @@ CHECK_SYMBOL_EXISTS (strncasecmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCAS
+ CHECK_SYMBOL_EXISTS (strncmpi "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNCMPI)
+ CHECK_SYMBOL_EXISTS (strnicmp "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_STRNICMP)
+ CHECK_SYMBOL_EXISTS (writev "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_WRITEV)
++CHECK_SYMBOL_EXISTS (arc4random_buf "${CMAKE_EXTRA_INCLUDE_FILES}" HAVE_ARC4RANDOM_BUF)
++
+
+ # On Android, the system headers may define __system_property_get(), but excluded
+ # from libc. We need to perform a link test instead of a header/symbol test.
+diff --git a/configure.ac b/configure.ac
+index 1d0fb5c..9a76369 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -683,6 +683,7 @@ CARES_CHECK_FUNC_STRNCASECMP
+ CARES_CHECK_FUNC_STRNCMPI
+ CARES_CHECK_FUNC_STRNICMP
+ CARES_CHECK_FUNC_WRITEV
++CARES_CHECK_FUNC_ARC4RANDOM_BUF
+
+
+ dnl check for AF_INET6
+diff --git a/m4/cares-functions.m4 b/m4/cares-functions.m4
+index 0f3992c..d4f4f99 100644
+--- a/m4/cares-functions.m4
++++ b/m4/cares-functions.m4
+@@ -3753,3 +3753,88 @@ AC_DEFUN([CARES_CHECK_FUNC_WRITEV], [
+ ac_cv_func_writev="no"
+ fi
+ ])
++
++dnl CARES_CHECK_FUNC_ARC4RANDOM_BUF
++dnl -------------------------------------------------
++dnl Verify if arc4random_buf is available, prototyped, and
++dnl can be compiled. If all of these are true, and
++dnl usage has not been previously disallowed with
++dnl shell variable cares_disallow_arc4random_buf, then
++dnl HAVE_ARC4RANDOM_BUF will be defined.
++
++AC_DEFUN([CARES_CHECK_FUNC_ARC4RANDOM_BUF], [
++ AC_REQUIRE([CARES_INCLUDES_STDLIB])dnl
++ #
++ tst_links_arc4random_buf="unknown"
++ tst_proto_arc4random_buf="unknown"
++ tst_compi_arc4random_buf="unknown"
++ tst_allow_arc4random_buf="unknown"
++ #
++ AC_MSG_CHECKING([if arc4random_buf can be linked])
++ AC_LINK_IFELSE([
++ AC_LANG_FUNC_LINK_TRY([arc4random_buf])
++ ],[
++ AC_MSG_RESULT([yes])
++ tst_links_arc4random_buf="yes"
++ ],[
++ AC_MSG_RESULT([no])
++ tst_links_arc4random_buf="no"
++ ])
++ #
++ if test "$tst_links_arc4random_buf" = "yes"; then
++ AC_MSG_CHECKING([if arc4random_buf is prototyped])
++ AC_EGREP_CPP([arc4random_buf],[
++ $cares_includes_stdlib
++ ],[
++ AC_MSG_RESULT([yes])
++ tst_proto_arc4random_buf="yes"
++ ],[
++ AC_MSG_RESULT([no])
++ tst_proto_arc4random_buf="no"
++ ])
++ fi
++ #
++ if test "$tst_proto_arc4random_buf" = "yes"; then
++ AC_MSG_CHECKING([if arc4random_buf is compilable])
++ AC_COMPILE_IFELSE([
++ AC_LANG_PROGRAM([[
++ $cares_includes_stdlib
++ ]],[[
++ arc4random_buf(NULL, 0);
++ return 1;
++ ]])
++ ],[
++ AC_MSG_RESULT([yes])
++ tst_compi_arc4random_buf="yes"
++ ],[
++ AC_MSG_RESULT([no])
++ tst_compi_arc4random_buf="no"
++ ])
++ fi
++ #
++ if test "$tst_compi_arc4random_buf" = "yes"; then
++ AC_MSG_CHECKING([if arc4random_buf usage allowed])
++ if test "x$cares_disallow_arc4random_buf" != "xyes"; then
++ AC_MSG_RESULT([yes])
++ tst_allow_arc4random_buf="yes"
++ else
++ AC_MSG_RESULT([no])
++ tst_allow_arc4random_buf="no"
++ fi
++ fi
++ #
++ AC_MSG_CHECKING([if arc4random_buf might be used])
++ if test "$tst_links_arc4random_buf" = "yes" &&
++ test "$tst_proto_arc4random_buf" = "yes" &&
++ test "$tst_compi_arc4random_buf" = "yes" &&
++ test "$tst_allow_arc4random_buf" = "yes"; then
++ AC_MSG_RESULT([yes])
++ AC_DEFINE_UNQUOTED(HAVE_ARC4RANDOM_BUF, 1,
++ [Define to 1 if you have the arc4random_buf function.])
++ ac_cv_func_arc4random_buf="yes"
++ else
++ AC_MSG_RESULT([no])
++ ac_cv_func_arc4random_buf="no"
++ fi
++])
++
+diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc
+index a3b060c..72a7673 100644
+--- a/src/lib/Makefile.inc
++++ b/src/lib/Makefile.inc
+@@ -45,6 +45,7 @@ CSOURCES = ares__addrinfo2hostent.c \
+ ares_platform.c \
+ ares_process.c \
+ ares_query.c \
++ ares_rand.c \
+ ares_search.c \
+ ares_send.c \
+ ares_strcasecmp.c \
+diff --git a/src/lib/ares_config.h.cmake b/src/lib/ares_config.h.cmake
+index fddb785..798820a 100644
+--- a/src/lib/ares_config.h.cmake
++++ b/src/lib/ares_config.h.cmake
+@@ -346,6 +346,9 @@
+ /* Define to 1 if you need the memory.h header file even with stdlib.h */
+ #cmakedefine NEED_MEMORY_H
+
++/* Define if have arc4random_buf() */
++#cmakedefine HAVE_ARC4RANDOM_BUF
++
+ /* a suitable file/device to read random data from */
+ #cmakedefine CARES_RANDOM_FILE "@CARES_RANDOM_FILE@"
+
+diff --git a/src/lib/ares_destroy.c b/src/lib/ares_destroy.c
+index fed2009..0447af4 100644
+--- a/src/lib/ares_destroy.c
++++ b/src/lib/ares_destroy.c
+@@ -90,6 +90,9 @@ void ares_destroy(ares_channel channel)
+ if (channel->resolvconf_path)
+ ares_free(channel->resolvconf_path);
+
++ if (channel->rand_state)
++ ares__destroy_rand_state(channel->rand_state);
++
+ ares_free(channel);
+ }
+
+diff --git a/src/lib/ares_init.c b/src/lib/ares_init.c
+index de5d86c..2607ed6 100644
+--- a/src/lib/ares_init.c
++++ b/src/lib/ares_init.c
+@@ -72,7 +72,6 @@ static int config_nameserver(struct server_state **servers, int *nservers,
+ static int set_search(ares_channel channel, const char *str);
+ static int set_options(ares_channel channel, const char *str);
+ static const char *try_option(const char *p, const char *q, const char *opt);
+-static int init_id_key(rc4_key* key,int key_data_len);
+
+ static int config_sortlist(struct apattern **sortlist, int *nsort,
+ const char *str);
+@@ -149,6 +148,7 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
+ channel->sock_funcs = NULL;
+ channel->sock_func_cb_data = NULL;
+ channel->resolvconf_path = NULL;
++ channel->rand_state = NULL;
+
+ channel->last_server = 0;
+ channel->last_timeout_processed = (time_t)now.tv_sec;
+@@ -202,9 +202,13 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
+ /* Generate random key */
+
+ if (status == ARES_SUCCESS) {
+- status = init_id_key(&channel->id_key, ARES_ID_KEY_LEN);
++ channel->rand_state = ares__init_rand_state();
++ if (channel->rand_state == NULL) {
++ status = ARES_ENOMEM;
++ }
++
+ if (status == ARES_SUCCESS)
+- channel->next_id = ares__generate_new_id(&channel->id_key);
++ channel->next_id = ares__generate_new_id(channel->rand_state);
+ else
+ DEBUGF(fprintf(stderr, "Error: init_id_key failed: %s\n",
+ ares_strerror(status)));
+@@ -224,6 +228,8 @@ done:
+ ares_free(channel->lookups);
+ if(channel->resolvconf_path)
+ ares_free(channel->resolvconf_path);
++ if (channel->rand_state)
++ ares__destroy_rand_state(channel->rand_state);
+ ares_free(channel);
+ return status;
+ }
+@@ -2495,76 +2501,6 @@ static int sortlist_alloc(struct apattern **sortlist, int *nsort,
+ return 1;
+ }
+
+-/* initialize an rc4 key. If possible a cryptographically secure random key
+- is generated using a suitable function (for example win32's RtlGenRandom as
+- described in
+- http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx
+- otherwise the code defaults to cross-platform albeit less secure mechanism
+- using rand
+-*/
+-static void randomize_key(unsigned char* key,int key_data_len)
+-{
+- int randomized = 0;
+- int counter=0;
+-#ifdef WIN32
+- BOOLEAN res;
+- if (ares_fpSystemFunction036)
+- {
+- res = (*ares_fpSystemFunction036) (key, key_data_len);
+- if (res)
+- randomized = 1;
+- }
+-#else /* !WIN32 */
+-#ifdef CARES_RANDOM_FILE
+- FILE *f = fopen(CARES_RANDOM_FILE, "rb");
+- if(f) {
+- setvbuf(f, NULL, _IONBF, 0);
+- counter = aresx_uztosi(fread(key, 1, key_data_len, f));
+- fclose(f);
+- }
+-#endif
+-#endif /* WIN32 */
+-
+- if (!randomized) {
+- for (;counter<key_data_len;counter++)
+- key[counter]=(unsigned char)(rand() % 256); /* LCOV_EXCL_LINE */
+- }
+-}
+-
+-static int init_id_key(rc4_key* key,int key_data_len)
+-{
+- unsigned char index1;
+- unsigned char index2;
+- unsigned char* state;
+- short counter;
+- unsigned char *key_data_ptr = 0;
+-
+- key_data_ptr = ares_malloc(key_data_len);
+- if (!key_data_ptr)
+- return ARES_ENOMEM;
+- memset(key_data_ptr, 0, key_data_len);
+-
+- state = &key->state[0];
+- for(counter = 0; counter < 256; counter++)
+- /* unnecessary AND but it keeps some compilers happier */
+- state[counter] = (unsigned char)(counter & 0xff);
+- randomize_key(key->state,key_data_len);
+- key->x = 0;
+- key->y = 0;
+- index1 = 0;
+- index2 = 0;
+- for(counter = 0; counter < 256; counter++)
+- {
+- index2 = (unsigned char)((key_data_ptr[index1] + state[counter] +
+- index2) % 256);
+- ARES_SWAP_BYTE(&state[counter], &state[index2]);
+-
+- index1 = (unsigned char)((index1 + 1) % key_data_len);
+- }
+- ares_free(key_data_ptr);
+- return ARES_SUCCESS;
+-}
+-
+ void ares_set_local_ip4(ares_channel channel, unsigned int local_ip)
+ {
+ channel->local_ip4 = local_ip;
+diff --git a/src/lib/ares_private.h b/src/lib/ares_private.h
+index 60d69e0..518b5c3 100644
+--- a/src/lib/ares_private.h
++++ b/src/lib/ares_private.h
+@@ -101,8 +101,6 @@ W32_FUNC const char *_w32_GetHostsFile (void);
+
+ #endif
+
+-#define ARES_ID_KEY_LEN 31
+-
+ #include "ares_ipv6.h"
+ #include "ares_llist.h"
+
+@@ -262,12 +260,8 @@ struct apattern {
+ unsigned short type;
+ };
+
+-typedef struct rc4_key
+-{
+- unsigned char state[256];
+- unsigned char x;
+- unsigned char y;
+-} rc4_key;
++struct ares_rand_state;
++typedef struct ares_rand_state ares_rand_state;
+
+ struct ares_channeldata {
+ /* Configuration data */
+@@ -302,8 +296,8 @@ struct ares_channeldata {
+
+ /* ID to use for next query */
+ unsigned short next_id;
+- /* key to use when generating new ids */
+- rc4_key id_key;
++ /* random state to use when generating new ids */
++ ares_rand_state *rand_state;
+
+ /* Generation number to use for the next TCP socket open/close */
+ int tcp_connection_generation;
+@@ -359,7 +353,10 @@ void ares__close_sockets(ares_channel channel, struct server_state *server);
+ int ares__get_hostent(FILE *fp, int family, struct hostent **host);
+ int ares__read_line(FILE *fp, char **buf, size_t *bufsize);
+ void ares__free_query(struct query *query);
+-unsigned short ares__generate_new_id(rc4_key* key);
++
++ares_rand_state *ares__init_rand_state(void);
++void ares__destroy_rand_state(ares_rand_state *state);
++unsigned short ares__generate_new_id(ares_rand_state *state);
+ struct timeval ares__tvnow(void);
+ int ares__expand_name_validated(const unsigned char *encoded,
+ const unsigned char *abuf,
+diff --git a/src/lib/ares_query.c b/src/lib/ares_query.c
+index 508274d..42323be 100644
+--- a/src/lib/ares_query.c
++++ b/src/lib/ares_query.c
+@@ -33,32 +33,6 @@ struct qquery {
+
+ static void qcallback(void *arg, int status, int timeouts, unsigned char *abuf, int alen);
+
+-static void rc4(rc4_key* key, unsigned char *buffer_ptr, int buffer_len)
+-{
+- unsigned char x;
+- unsigned char y;
+- unsigned char* state;
+- unsigned char xorIndex;
+- int counter;
+-
+- x = key->x;
+- y = key->y;
+-
+- state = &key->state[0];
+- for(counter = 0; counter < buffer_len; counter ++)
+- {
+- x = (unsigned char)((x + 1) % 256);
+- y = (unsigned char)((state[x] + y) % 256);
+- ARES_SWAP_BYTE(&state[x], &state[y]);
+-
+- xorIndex = (unsigned char)((state[x] + state[y]) % 256);
+-
+- buffer_ptr[counter] = (unsigned char)(buffer_ptr[counter]^state[xorIndex]);
+- }
+- key->x = x;
+- key->y = y;
+-}
+-
+ static struct query* find_query_by_id(ares_channel channel, unsigned short id)
+ {
+ unsigned short qid;
+@@ -78,7 +52,6 @@ static struct query* find_query_by_id(ares_channel channel, unsigned short id)
+ return NULL;
+ }
+
+-
+ /* a unique query id is generated using an rc4 key. Since the id may already
+ be used by a running query (as infrequent as it may be), a lookup is
+ performed per id generation. In practice this search should happen only
+@@ -89,19 +62,12 @@ static unsigned short generate_unique_id(ares_channel channel)
+ unsigned short id;
+
+ do {
+- id = ares__generate_new_id(&channel->id_key);
++ id = ares__generate_new_id(channel->rand_state);
+ } while (find_query_by_id(channel, id));
+
+ return (unsigned short)id;
+ }
+
+-unsigned short ares__generate_new_id(rc4_key* key)
+-{
+- unsigned short r=0;
+- rc4(key, (unsigned char *)&r, sizeof(r));
+- return r;
+-}
+-
+ void ares_query(ares_channel channel, const char *name, int dnsclass,
+ int type, ares_callback callback, void *arg)
+ {
+diff --git a/src/lib/ares_rand.c b/src/lib/ares_rand.c
+new file mode 100644
+index 0000000..a564bc2
+--- /dev/null
++++ b/src/lib/ares_rand.c
+@@ -0,0 +1,274 @@
++/* Copyright 1998 by the Massachusetts Institute of Technology.
++ * Copyright (C) 2007-2013 by Daniel Stenberg
++ *
++ * Permission to use, copy, modify, and distribute this
++ * software and its documentation for any purpose and without
++ * fee is hereby granted, provided that the above copyright
++ * notice appear in all copies and that both that copyright
++ * notice and this permission notice appear in supporting
++ * documentation, and that the name of M.I.T. not be used in
++ * advertising or publicity pertaining to distribution of the
++ * software without specific, written prior permission.
++ * M.I.T. makes no representations about the suitability of
++ * this software for any purpose. It is provided "as is"
++ * without express or implied warranty.
++ */
++
++#include "ares_setup.h"
++#include "ares.h"
++#include "ares_private.h"
++#include "ares_nowarn.h"
++#include <stdlib.h>
++
++typedef enum {
++ ARES_RAND_OS = 1, /* OS-provided such as RtlGenRandom or arc4random */
++ ARES_RAND_FILE = 2, /* OS file-backed random number generator */
++ ARES_RAND_RC4 = 3 /* Internal RC4 based PRNG */
++} ares_rand_backend;
++
++typedef struct ares_rand_rc4
++{
++ unsigned char S[256];
++ size_t i;
++ size_t j;
++} ares_rand_rc4;
++
++struct ares_rand_state
++{
++ ares_rand_backend type;
++ union {
++ FILE *rand_file;
++ ares_rand_rc4 rc4;
++ } state;
++};
++
++
++/* Define RtlGenRandom = SystemFunction036. This is in advapi32.dll. There is
++ * no need to dynamically load this, other software used widely does not.
++ * http://blogs.msdn.com/michael_howard/archive/2005/01/14/353379.aspx
++ * https://docs.microsoft.com/en-us/windows/win32/api/ntsecapi/nf-ntsecapi-rtlgenrandom
++ */
++#ifdef _WIN32
++BOOLEAN WINAPI SystemFunction036(PVOID RandomBuffer, ULONG RandomBufferLength);
++# ifndef RtlGenRandom
++# define RtlGenRandom(a,b) SystemFunction036(a,b)
++# endif
++#endif
++
++
++#define ARES_RC4_KEY_LEN 32 /* 256 bits */
++
++static unsigned int ares_u32_from_ptr(void *addr)
++{
++ if (sizeof(void *) == 8) {
++ return (unsigned int)((((size_t)addr >> 32) & 0xFFFFFFFF) | ((size_t)addr & 0xFFFFFFFF));
++ }
++ return (unsigned int)((size_t)addr & 0xFFFFFFFF);
++}
++
++
++/* initialize an rc4 key as the last possible fallback. */
++static void ares_rc4_generate_key(ares_rand_rc4 *rc4_state, unsigned char *key, size_t key_len)
++{
++ size_t i;
++ size_t len = 0;
++ unsigned int data;
++ struct timeval tv;
++
++ if (key_len != ARES_RC4_KEY_LEN)
++ return;
++
++ /* Randomness is hard to come by. Maybe the system randomizes heap and stack addresses.
++ * Maybe the current timestamp give us some randomness.
++ * Use rc4_state (heap), &i (stack), and ares__tvnow()
++ */
++ data = ares_u32_from_ptr(rc4_state);
++ memcpy(key + len, &data, sizeof(data));
++ len += sizeof(data);
++
++ data = ares_u32_from_ptr(&i);
++ memcpy(key + len, &data, sizeof(data));
++ len += sizeof(data);
++
++ tv = ares__tvnow();
++ data = (unsigned int)((tv.tv_sec | tv.tv_usec) & 0xFFFFFFFF);
++ memcpy(key + len, &data, sizeof(data));
++ len += sizeof(data);
++
++ srand(ares_u32_from_ptr(rc4_state) | ares_u32_from_ptr(&i) | (unsigned int)((tv.tv_sec | tv.tv_usec) & 0xFFFFFFFF));
++
++ for (i=len; i<key_len; i++) {
++ key[i]=(unsigned char)(rand() % 256); /* LCOV_EXCL_LINE */
++ }
++}
++
++
++static void ares_rc4_init(ares_rand_rc4 *rc4_state)
++{
++ unsigned char key[ARES_RC4_KEY_LEN];
++ size_t i;
++ size_t j;
++
++ ares_rc4_generate_key(rc4_state, key, sizeof(key));
++
++ for (i = 0; i < sizeof(rc4_state->S); i++) {
++ rc4_state->S[i] = i & 0xFF;
++ }
++
++ for(i = 0, j = 0; i < 256; i++) {
++ j = (j + rc4_state->S[i] + key[i % sizeof(key)]) % 256;
++ ARES_SWAP_BYTE(&rc4_state->S[i], &rc4_state->S[j]);
++ }
++
++ rc4_state->i = 0;
++ rc4_state->j = 0;
++}
++
++/* Just outputs the key schedule, no need to XOR with any data since we have none */
++static void ares_rc4_prng(ares_rand_rc4 *rc4_state, unsigned char *buf, int len)
++{
++ unsigned char *S = rc4_state->S;
++ size_t i = rc4_state->i;
++ size_t j = rc4_state->j;
++ size_t cnt;
++
++ for (cnt=0; cnt<len; cnt++) {
++ i = (i + 1) % 256;
++ j = (j + S[i]) % 256;
++
++ ARES_SWAP_BYTE(&S[i], &S[j]);
++ buf[cnt] = S[(S[i] + S[j]) % 256];
++ }
++
++ rc4_state->i = i;
++ rc4_state->j = j;
++}
++
++
++static int ares__init_rand_engine(ares_rand_state *state)
++{
++ memset(state, 0, sizeof(*state));
++
++#if defined(HAVE_ARC4RANDOM_BUF) || defined(_WIN32)
++ state->type = ARES_RAND_OS;
++ return 1;
++#elif defined(CARES_RANDOM_FILE)
++ state->type = ARES_RAND_FILE;
++ state->state.rand_file = fopen(CARES_RANDOM_FILE, "rb");
++ if (state->state.rand_file) {
++ setvbuf(state->state.rand_file, NULL, _IONBF, 0);
++ return 1;
++ }
++ /* Fall-Thru on failure to RC4 */
++#endif
++
++ state->type = ARES_RAND_RC4;
++ ares_rc4_init(&state->state.rc4);
++
++ /* Currently cannot fail */
++ return 1;
++}
++
++
++ares_rand_state *ares__init_rand_state()
++{
++ ares_rand_state *state = NULL;
++
++ state = ares_malloc(sizeof(*state));
++ if (!state)
++ return NULL;
++
++ if (!ares__init_rand_engine(state)) {
++ ares_free(state);
++ return NULL;
++ }
++
++ return state;
++}
++
++
++static void ares__clear_rand_state(ares_rand_state *state)
++{
++ if (!state)
++ return;
++
++ switch (state->type) {
++ case ARES_RAND_OS:
++ break;
++ case ARES_RAND_FILE:
++ fclose(state->state.rand_file);
++ break;
++ case ARES_RAND_RC4:
++ break;
++ }
++}
++
++
++static void ares__reinit_rand(ares_rand_state *state)
++{
++ ares__clear_rand_state(state);
++ ares__init_rand_engine(state);
++}
++
++
++void ares__destroy_rand_state(ares_rand_state *state)
++{
++ if (!state)
++ return;
++
++ ares__clear_rand_state(state);
++ ares_free(state);
++}
++
++
++static void ares__rand_bytes(ares_rand_state *state, unsigned char *buf, size_t len)
++{
++
++ while (1) {
++ size_t rv;
++ size_t bytes_read = 0;
++
++ switch (state->type) {
++ case ARES_RAND_OS:
++#ifdef _WIN32
++ RtlGenRandom(buf, len);
++ return;
++#elif defined(HAVE_ARC4RANDOM_BUF)
++ arc4random_buf(buf, len);
++ return;
++#else
++ /* Shouldn't be possible to be here */
++ break;
++#endif
++
++ case ARES_RAND_FILE:
++ while (1) {
++ size_t rv = fread(buf + bytes_read, 1, len - bytes_read, state->state.rand_file);
++ if (rv == 0)
++ break; /* critical error, will reinit rand state */
++
++ bytes_read += rv;
++ if (bytes_read == len)
++ return;
++ }
++ break;
++
++ case ARES_RAND_RC4:
++ ares_rc4_prng(&state->state.rc4, buf, len);
++ return;
++ }
++
++ /* If we didn't return before we got here, that means we had a critical rand
++ * failure and need to reinitialized */
++ ares__reinit_rand(state);
++ }
++}
++
++unsigned short ares__generate_new_id(ares_rand_state *state)
++{
++ unsigned short r=0;
++
++ ares__rand_bytes(state, (unsigned char *)&r, sizeof(r));
++ return r;
++}
++
+--
+2.30.2
+
diff --git a/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch b/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch
new file mode 100644
index 0000000000..f6bcaee534
--- /dev/null
+++ b/meta-oe/recipes-support/c-ares/c-ares/CVE-2023-32067.patch
@@ -0,0 +1,85 @@
+From b9b8413cfdb70a3f99e1573333b23052d57ec1ae Mon Sep 17 00:00:00 2001
+From: Brad House <brad@brad-house.com>
+Date: Mon, 22 May 2023 06:51:49 -0400
+Subject: [PATCH] Merge pull request from GHSA-9g78-jv2r-p7vc
+
+Upstream-Status: Backport [https://github.com/c-ares/c-ares/commit/b9b8413cfdb70a3f99e1573333b23052d57ec1ae.patch]
+CVE: CVE-2023-32067
+Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
+---
+ src/lib/ares_process.c | 41 +++++++++++++++++++++++++----------------
+ 1 file changed, 25 insertions(+), 16 deletions(-)
+
+diff --git a/src/lib/ares_process.c b/src/lib/ares_process.c
+index 87329e3..605e5f8 100644
+--- a/src/lib/ares_process.c
++++ b/src/lib/ares_process.c
+@@ -457,7 +457,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
+ {
+ struct server_state *server;
+ int i;
+- ares_ssize_t count;
++ ares_ssize_t read_len;
+ unsigned char buf[MAXENDSSZ + 1];
+ #ifdef HAVE_RECVFROM
+ ares_socklen_t fromlen;
+@@ -500,32 +500,41 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
+ /* To reduce event loop overhead, read and process as many
+ * packets as we can. */
+ do {
+- if (server->udp_socket == ARES_SOCKET_BAD)
+- count = 0;
+-
+- else {
+- if (server->addr.family == AF_INET)
++ if (server->udp_socket == ARES_SOCKET_BAD) {
++ read_len = -1;
++ } else {
++ if (server->addr.family == AF_INET) {
+ fromlen = sizeof(from.sa4);
+- else
++ } else {
+ fromlen = sizeof(from.sa6);
+- count = socket_recvfrom(channel, server->udp_socket, (void *)buf,
+- sizeof(buf), 0, &from.sa, &fromlen);
++ }
++ read_len = socket_recvfrom(channel, server->udp_socket, (void *)buf,
++ sizeof(buf), 0, &from.sa, &fromlen);
+ }
+
+- if (count == -1 && try_again(SOCKERRNO))
++ if (read_len == 0) {
++ /* UDP is connectionless, so result code of 0 is a 0-length UDP
++ * packet, and not an indication the connection is closed like on
++ * tcp */
+ continue;
+- else if (count <= 0)
++ } else if (read_len < 0) {
++ if (try_again(SOCKERRNO))
++ continue;
++
+ handle_error(channel, i, now);
++
+ #ifdef HAVE_RECVFROM
+- else if (!same_address(&from.sa, &server->addr))
++ } else if (!same_address(&from.sa, &server->addr)) {
+ /* The address the response comes from does not match the address we
+ * sent the request to. Someone may be attempting to perform a cache
+ * poisoning attack. */
+- break;
++ continue;
+ #endif
+- else
+- process_answer(channel, buf, (int)count, i, 0, now);
+- } while (count > 0);
++
++ } else {
++ process_answer(channel, buf, (int)read_len, i, 0, now);
++ }
++ } while (read_len >= 0);
+ }
+ }
+
+--
+2.25.1
+
diff --git a/meta-oe/recipes-support/c-ares/c-ares/CVE-2024-25629.patch b/meta-oe/recipes-support/c-ares/c-ares/CVE-2024-25629.patch
new file mode 100644
index 0000000000..4c97eda3c7
--- /dev/null
+++ b/meta-oe/recipes-support/c-ares/c-ares/CVE-2024-25629.patch
@@ -0,0 +1,34 @@
+From: a804c04ddc8245fc8adf0e92368709639125e183 Mon Sep 17 00:00:00 2001
+From: Brad House <brad@brad-house.com>
+Date: Mon, 11 Mar 2024 14:29:39 +0000
+Subject: [PATCH] Merge pull request from GHSA-mg26-v6qh-x48q
+
+CVE: CVE-2024-25629
+Upstream-Status: Backport [https://github.com/c-ares/c-ares/commit/a804c04ddc8245fc8adf0e92368709639125e183]
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ src/lib/ares__read_line.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/lib/ares__read_line.c b/src/lib/ares__read_line.c
+index c62ad2a..d6625a3 100644
+--- a/src/lib/ares__read_line.c
++++ b/src/lib/ares__read_line.c
+@@ -49,6 +49,14 @@ int ares__read_line(FILE *fp, char **buf, size_t *bufsize)
+ if (!fgets(*buf + offset, bytestoread, fp))
+ return (offset != 0) ? 0 : (ferror(fp)) ? ARES_EFILE : ARES_EOF;
+ len = offset + strlen(*buf + offset);
++
++ /* Probably means there was an embedded NULL as the first character in
++ * the line, throw away line */
++ if (len == 0) {
++ offset = 0;
++ continue;
++ }
++
+ if ((*buf)[len - 1] == '\n')
+ {
+ (*buf)[len - 1] = 0;
+--
+2.40.0
diff --git a/meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb b/meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb
index 2cd00cb578..838046146f 100644
--- a/meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb
+++ b/meta-oe/recipes-support/c-ares/c-ares_1.18.1.bb
@@ -5,7 +5,13 @@ SECTION = "libs"
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE.md;md5=fb997454c8d62aa6a47f07a8cd48b006"
-SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https"
+SRC_URI = "git://github.com/c-ares/c-ares.git;branch=main;protocol=https \
+ file://CVE-2022-4904.patch \
+ file://CVE-2023-31130.patch \
+ file://CVE-2023-32067.patch \
+ file://CVE-2023-31147.patch \
+ file://CVE-2024-25629.patch \
+ "
SRCREV = "2aa086f822aad5017a6f2061ef656f237a62d0ed"
UPSTREAM_CHECK_GITTAGREGEX = "cares-(?P<pver>\d+_(\d_?)+)"
@@ -19,3 +25,7 @@ PACKAGES =+ "${PN}-utils"
FILES:${PN}-utils = "${bindir}"
BBCLASSEXTEND = "native nativesdk"
+
+# this vulneribility applies only when cross-compiling using autotools
+# yocto cross-compiles via cmake which is also listed as official workaround
+CVE_CHECK_IGNORE += "CVE-2023-31124"
diff --git a/meta-oe/recipes-support/exiv2/exiv2_0.27.3.bb b/meta-oe/recipes-support/exiv2/exiv2_0.27.3.bb
index 31afe78e45..b210fa6340 100644
--- a/meta-oe/recipes-support/exiv2/exiv2_0.27.3.bb
+++ b/meta-oe/recipes-support/exiv2/exiv2_0.27.3.bb
@@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=625f055f41728f84a8d7938acc35bdc2"
DEPENDS = "zlib expat"
-SRC_URI = "https://exiv2.org/releases/${BPN}-${PV}-Source.tar.gz"
+SRC_URI = "https://github.com/Exiv2/${BPN}/releases/download/v${PV}/${BP}-Source.tar.gz"
SRC_URI[sha256sum] = "a79f5613812aa21755d578a297874fb59a85101e793edc64ec2c6bd994e3e778"
# Once patch is obsolete (project should be aware due to PRs), dos2unix can be removed either
diff --git a/meta-oe/recipes-support/freerdp/freerdp/CVE-2022-39316.patch b/meta-oe/recipes-support/freerdp/freerdp/CVE-2022-39316.patch
new file mode 100644
index 0000000000..a60b2854c8
--- /dev/null
+++ b/meta-oe/recipes-support/freerdp/freerdp/CVE-2022-39316.patch
@@ -0,0 +1,53 @@
+https://github.com/FreeRDP/FreeRDP/commit/e865c24efc40ebc52e75979c94cdd4ee2c1495b0
+CVE: CVE-2022-39316
+Upstream-Status: Backport
+Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
+
+From e865c24efc40ebc52e75979c94cdd4ee2c1495b0 Mon Sep 17 00:00:00 2001
+From: akallabeth <akallabeth@posteo.net>
+Date: Thu, 13 Oct 2022 09:09:28 +0200
+Subject: [PATCH] Added missing length checks in zgfx_decompress_segment
+
+(cherry picked from commit 64716b335858109d14f27b51acc4c4d71a92a816)
+---
+ libfreerdp/codec/zgfx.c | 11 +++++++----
+ 1 file changed, 7 insertions(+), 4 deletions(-)
+
+diff --git a/libfreerdp/codec/zgfx.c b/libfreerdp/codec/zgfx.c
+index 20fbd354571..e260aa6e28a 100644
+--- a/libfreerdp/codec/zgfx.c
++++ b/libfreerdp/codec/zgfx.c
+@@ -230,19 +230,19 @@ static BOOL zgfx_decompress_segment(ZGFX_CONTEXT* zgfx, wStream* stream, size_t
+ BYTE* pbSegment;
+ size_t cbSegment;
+
+- if (!zgfx || !stream)
++ if (!zgfx || !stream || (segmentSize < 2))
+ return FALSE;
+
+ cbSegment = segmentSize - 1;
+
+- if ((Stream_GetRemainingLength(stream) < segmentSize) || (segmentSize < 1) ||
+- (segmentSize > UINT32_MAX))
++ if ((Stream_GetRemainingLength(stream) < segmentSize) || (segmentSize > UINT32_MAX))
+ return FALSE;
+
+ Stream_Read_UINT8(stream, flags); /* header (1 byte) */
+ zgfx->OutputCount = 0;
+ pbSegment = Stream_Pointer(stream);
+- Stream_Seek(stream, cbSegment);
++ if (!Stream_SafeSeek(stream, cbSegment))
++ return FALSE;
+
+ if (!(flags & PACKET_COMPRESSED))
+ {
+@@ -346,6 +346,9 @@ static BOOL zgfx_decompress_segment(ZGFX_CONTEXT* zgfx, wStream* stream, size_t
+ if (count > sizeof(zgfx->OutputBuffer) - zgfx->OutputCount)
+ return FALSE;
+
++ if (count > zgfx->cBitsRemaining / 8)
++ return FALSE;
++
+ CopyMemory(&(zgfx->OutputBuffer[zgfx->OutputCount]), zgfx->pbInputCurrent,
+ count);
+ zgfx_history_buffer_ring_write(zgfx, zgfx->pbInputCurrent, count);
diff --git a/meta-oe/recipes-support/freerdp/freerdp/CVE-2022-39318-39319.patch b/meta-oe/recipes-support/freerdp/freerdp/CVE-2022-39318-39319.patch
new file mode 100644
index 0000000000..76a9e00dd3
--- /dev/null
+++ b/meta-oe/recipes-support/freerdp/freerdp/CVE-2022-39318-39319.patch
@@ -0,0 +1,41 @@
+https://github.com/FreeRDP/FreeRDP/commit/80adde17ddc4b596ed1dae0922a0c54ab3d4b8ea
+CVE: CVE-2022-39318 CVE-2022-39319
+Upstream-Status: Backport
+Signed-off-by: Lee Chee Yang <chee.yang.lee@intel.com>
+
+From 80adde17ddc4b596ed1dae0922a0c54ab3d4b8ea Mon Sep 17 00:00:00 2001
+From: akallabeth <akallabeth@posteo.net>
+Date: Thu, 13 Oct 2022 08:27:41 +0200
+Subject: [PATCH] Fixed division by zero in urbdrc
+
+(cherry picked from commit 731f8419d04b481d7160de1f34062d630ed48765)
+---
+ channels/urbdrc/client/libusb/libusb_udevice.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+diff --git a/channels/urbdrc/client/libusb/libusb_udevice.c b/channels/urbdrc/client/libusb/libusb_udevice.c
+index 505c31d7b55..ef87f195f38 100644
+--- a/channels/urbdrc/client/libusb/libusb_udevice.c
++++ b/channels/urbdrc/client/libusb/libusb_udevice.c
+@@ -1221,12 +1221,18 @@ static int libusb_udev_isoch_transfer(IUDEVICE* idev, URBDRC_CHANNEL_CALLBACK* c
+ if (!Buffer)
+ Stream_Seek(user_data->data, (NumberOfPackets * 12));
+
+- iso_packet_size = BufferSize / NumberOfPackets;
+- iso_transfer = libusb_alloc_transfer(NumberOfPackets);
++ if (NumberOfPackets > 0)
++ {
++ iso_packet_size = BufferSize / NumberOfPackets;
++ iso_transfer = libusb_alloc_transfer((int)NumberOfPackets);
++ }
+
+ if (iso_transfer == NULL)
+ {
+- WLog_Print(urbdrc->log, WLOG_ERROR, "Error: libusb_alloc_transfer.");
++ WLog_Print(urbdrc->log, WLOG_ERROR,
++ "Error: libusb_alloc_transfer [NumberOfPackets=%" PRIu32 ", BufferSize=%" PRIu32
++ " ]",
++ NumberOfPackets, BufferSize);
+ async_transfer_user_data_free(user_data);
+ return -1;
+ }
diff --git a/meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb b/meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb
index ece2f56960..9da8b27c0d 100644
--- a/meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb
+++ b/meta-oe/recipes-support/freerdp/freerdp_2.6.1.bb
@@ -16,6 +16,8 @@ PKGV = "${GITPKGVTAG}"
SRCREV = "658a72980f6e93241d927c46cfa664bf2547b8b1"
SRC_URI = "git://github.com/FreeRDP/FreeRDP.git;branch=stable-2.0;protocol=https \
file://winpr-makecert-Build-with-install-RPATH.patch \
+ file://CVE-2022-39316.patch \
+ file://CVE-2022-39318-39319.patch \
"
S = "${WORKDIR}/git"
diff --git a/meta-oe/recipes-support/glog/glog_0.5.0.bb b/meta-oe/recipes-support/glog/glog_0.5.0.bb
index 61581d96d7..f0b1293965 100644
--- a/meta-oe/recipes-support/glog/glog_0.5.0.bb
+++ b/meta-oe/recipes-support/glog/glog_0.5.0.bb
@@ -7,7 +7,7 @@ LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=dc9db360e0bbd4e46672f3fd91dd6c4b"
SRC_URI = " \
- git://github.com/google/glog.git;nobranch=1;protocol=https \
+ git://github.com/google/glog.git;branch=master;protocol=https \
file://libexecinfo.patch \
"
diff --git a/meta-oe/recipes-support/gnulib/gnulib_2018-03-07.03.bb b/meta-oe/recipes-support/gnulib/gnulib_2018-12-18.bb
index a27968079e..a27968079e 100644
--- a/meta-oe/recipes-support/gnulib/gnulib_2018-03-07.03.bb
+++ b/meta-oe/recipes-support/gnulib/gnulib_2018-12-18.bb
diff --git a/meta-oe/recipes-support/hdf5/files/CVE-2021-37501.patch b/meta-oe/recipes-support/hdf5/files/CVE-2021-37501.patch
new file mode 100644
index 0000000000..01099f3438
--- /dev/null
+++ b/meta-oe/recipes-support/hdf5/files/CVE-2021-37501.patch
@@ -0,0 +1,37 @@
+From 602015eacc53bf2699bf4c4e5420b63c3f067547 Mon Sep 17 00:00:00 2001
+From: Mingli Yu <mingli.yu@windriver.com>
+Date: Mon, 11 Sep 2023 14:01:37 +0800
+Subject: [PATCH] Check for overflow when calculating on-disk attribute data
+ size
+
+Bogus sizes in this test case causes the on-disk data size
+calculation in H5O_attr_decode() to overflow so that the
+calculated size becomes 0. This causes the read to overflow
+and h5dump to segfault.
+
+CVE: CVE-2021-37501
+
+Upstream-Status: Backport [https://github.com/HDFGroup/hdf5/commit/b16ec83d4bd79f9ffaad85de16056419f3532887]
+
+Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
+---
+ src/H5Oattr.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/H5Oattr.c b/src/H5Oattr.c
+index c2c0fe3..c289344 100644
+--- a/src/H5Oattr.c
++++ b/src/H5Oattr.c
+@@ -217,6 +217,9 @@ H5O_attr_decode(H5F_t *f, hid_t dxpl_id, H5O_t *open_oh, unsigned H5_ATTR_UNUSED
+
+ /* Compute the size of the data */
+ H5_CHECKED_ASSIGN(attr->shared->data_size, size_t, H5S_GET_EXTENT_NPOINTS(attr->shared->ds) * H5T_get_size(attr->shared->dt), hsize_t);
++ /* Check if multiplication has overflown */
++ if ((attr->shared->data_size / H5T_get_size(attr->shared->dt)) != H5S_GET_EXTENT_NPOINTS(attr->shared->ds))
++ HGOTO_ERROR(H5E_RESOURCE, H5E_OVERFLOW, NULL, "data size exceeds addressable range");
+
+ /* Go get the data */
+ if(attr->shared->data_size) {
+--
+2.25.1
+
diff --git a/meta-oe/recipes-support/hdf5/hdf5_1.8.21.bb b/meta-oe/recipes-support/hdf5/hdf5_1.8.21.bb
index 7b886a4635..4110e9cea4 100644
--- a/meta-oe/recipes-support/hdf5/hdf5_1.8.21.bb
+++ b/meta-oe/recipes-support/hdf5/hdf5_1.8.21.bb
@@ -17,6 +17,7 @@ SRC_URI = " \
file://0001-cross-compiling-support.patch \
file://0002-Remove-suffix-shared-from-shared-library-name.patch \
file://0001-cmake-remove-build-flags.patch \
+ file://CVE-2021-37501.patch \
"
SRC_URI[md5sum] = "2d2408f2a9dfb5c7b79998002e9a90e9"
SRC_URI[sha256sum] = "e5b1b1dee44a64b795a91c3321ab7196d9e0871fe50d42969761794e3899f40d"
diff --git a/meta-oe/recipes-support/iniparser/iniparser/CVE-2023-33461.patch b/meta-oe/recipes-support/iniparser/iniparser/CVE-2023-33461.patch
new file mode 100644
index 0000000000..1b577fa334
--- /dev/null
+++ b/meta-oe/recipes-support/iniparser/iniparser/CVE-2023-33461.patch
@@ -0,0 +1,51 @@
+From ace9871f65d11b5d73f0b9ee8cf5d2807439442d Mon Sep 17 00:00:00 2001
+From: Antonio <antoniolrt@gmail.com>
+Date: Fri, 2 Jun 2023 15:03:10 -0300
+Subject: [PATCH] Handle null return from iniparser_getstring
+
+Fix handling of NULL returns from iniparser_getstring in
+iniparser_getboolean, iniparser_getlongint and iniparser_getdouble,
+avoiding a crash.
+
+CVE: CVE-2023-33461
+
+Upstream-Status: Backport [https://github.com/ndevilla/iniparser/commit/ace9871f65d11b5d73f0b9ee8cf5d2807439442d]
+
+Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
+---
+ src/iniparser.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/iniparser.c b/src/iniparser.c
+index f1d1658..dbceb20 100644
+--- a/src/iniparser.c
++++ b/src/iniparser.c
+@@ -456,7 +456,7 @@ long int iniparser_getlongint(const dictionary * d, const char * key, long int n
+ const char * str ;
+
+ str = iniparser_getstring(d, key, INI_INVALID_KEY);
+- if (str==INI_INVALID_KEY) return notfound ;
++ if (str==NULL || str==INI_INVALID_KEY) return notfound ;
+ return strtol(str, NULL, 0);
+ }
+
+@@ -511,7 +511,7 @@ double iniparser_getdouble(const dictionary * d, const char * key, double notfou
+ const char * str ;
+
+ str = iniparser_getstring(d, key, INI_INVALID_KEY);
+- if (str==INI_INVALID_KEY) return notfound ;
++ if (str==NULL || str==INI_INVALID_KEY) return notfound ;
+ return atof(str);
+ }
+
+@@ -553,7 +553,7 @@ int iniparser_getboolean(const dictionary * d, const char * key, int notfound)
+ const char * c ;
+
+ c = iniparser_getstring(d, key, INI_INVALID_KEY);
+- if (c==INI_INVALID_KEY) return notfound ;
++ if (c==NULL || c==INI_INVALID_KEY) return notfound ;
+ if (c[0]=='y' || c[0]=='Y' || c[0]=='1' || c[0]=='t' || c[0]=='T') {
+ ret = 1 ;
+ } else if (c[0]=='n' || c[0]=='N' || c[0]=='0' || c[0]=='f' || c[0]=='F') {
+--
+2.40.0
diff --git a/meta-oe/recipes-support/iniparser/iniparser_4.1.bb b/meta-oe/recipes-support/iniparser/iniparser_4.1.bb
index 2810a4f651..7c23b514bd 100644
--- a/meta-oe/recipes-support/iniparser/iniparser_4.1.bb
+++ b/meta-oe/recipes-support/iniparser/iniparser_4.1.bb
@@ -10,7 +10,9 @@ PV .= "+git${SRCPV}"
SRC_URI = "git://github.com/ndevilla/iniparser.git;protocol=https;branch=master \
file://0001-iniparser.pc-Make-libpath-a-variable.patch \
- file://Add-CMake-support.patch"
+ file://Add-CMake-support.patch \
+ file://CVE-2023-33461.patch \
+"
SRCREV= "deb85ad4936d4ca32cc2260ce43323d47936410d"
diff --git a/meta-oe/recipes-support/libbytesize/libbytesize_2.6.bb b/meta-oe/recipes-support/libbytesize/libbytesize_2.6.bb
index 154973254d..abafaaf7a7 100644
--- a/meta-oe/recipes-support/libbytesize/libbytesize_2.6.bb
+++ b/meta-oe/recipes-support/libbytesize/libbytesize_2.6.bb
@@ -10,7 +10,7 @@ S = "${WORKDIR}/git"
B = "${S}"
SRCREV = "c9864f4dd03736839f40d225da494cb1eb64e654"
-SRC_URI = "git://github.com/rhinstaller/libbytesize;branch=master;protocol=https"
+SRC_URI = "git://github.com/rhinstaller/libbytesize;branch=main;protocol=https"
inherit gettext autotools pkgconfig python3native
diff --git a/meta-oe/recipes-support/libeigen/libeigen_3.4.0.bb b/meta-oe/recipes-support/libeigen/libeigen_3.4.0.bb
index 1cae76b422..144d79dd15 100644
--- a/meta-oe/recipes-support/libeigen/libeigen_3.4.0.bb
+++ b/meta-oe/recipes-support/libeigen/libeigen_3.4.0.bb
@@ -1,7 +1,7 @@
DESCRIPTION = "Eigen is a C++ template library for linear algebra: matrices, vectors, numerical solvers, and related algorithms."
AUTHOR = "Benoît Jacob and Gaël Guennebaud and others"
HOMEPAGE = "http://eigen.tuxfamily.org/"
-LICENSE = "MPL-2.0 & Apache-2.0 & BSD-3-Clause & GPL-3.0-only & LGPL-2.1-only & MINPACK"
+LICENSE = "MPL-2.0 & Apache-2.0 & BSD-3-Clause & GPL-2.0-only & LGPL-2.1-only & MINPACK"
LIC_FILES_CHKSUM = "file://COPYING.MPL2;md5=815ca599c9df247a0c7f619bab123dad \
file://COPYING.BSD;md5=2dd0510ee95e59ca28834b875bc96596 \
file://COPYING.GPL;md5=d32239bcb673463ab874e80d47fae504 \
diff --git a/meta-oe/recipes-support/libiio/libiio_git.bb b/meta-oe/recipes-support/libiio/libiio_git.bb
index bb253f421a..612dd897be 100644
--- a/meta-oe/recipes-support/libiio/libiio_git.bb
+++ b/meta-oe/recipes-support/libiio/libiio_git.bb
@@ -7,7 +7,7 @@ LIC_FILES_CHKSUM = "file://COPYING.txt;md5=7c13b3376cea0ce68d2d2da0a1b3a72c"
SRCREV = "92d6a35f3d8d721cda7d6fe664b435311dd368b4"
PV = "0.23"
-SRC_URI = "git://github.com/analogdevicesinc/libiio.git;protocol=https;branch=master \
+SRC_URI = "git://github.com/analogdevicesinc/libiio.git;protocol=https;branch=main \
file://0001-CMake-Move-include-CheckCSourceCompiles-before-its-m.patch \
"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
diff --git a/meta-oe/recipes-support/libmxml/libmxml_3.3.bb b/meta-oe/recipes-support/libmxml/libmxml_3.3.bb
index c8e2167795..5169337f58 100644
--- a/meta-oe/recipes-support/libmxml/libmxml_3.3.bb
+++ b/meta-oe/recipes-support/libmxml/libmxml_3.3.bb
@@ -4,7 +4,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
HOMEPAGE = "https://www.msweet.org/mxml/"
BUGTRACKER = "https://github.com/michaelrsweet/mxml/issues"
-SRC_URI = "git://github.com/michaelrsweet/mxml.git;nobranch=1;protocol=https"
+SRC_URI = "git://github.com/michaelrsweet/mxml.git;branch=master;protocol=https"
SRCREV = "0237559fdbcecae34157b547aa2b99e12de305a2"
S = "${WORKDIR}/git"
diff --git a/meta-oe/recipes-support/libssh/libssh/0001-config-Move-common-parser-functions-to-config_parser.patch b/meta-oe/recipes-support/libssh/libssh/0001-config-Move-common-parser-functions-to-config_parser.patch
new file mode 100644
index 0000000000..f26b644102
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/0001-config-Move-common-parser-functions-to-config_parser.patch
@@ -0,0 +1,464 @@
+From 79049981a513f9a10fac0f153e9b0b588326021f Mon Sep 17 00:00:00 2001
+From: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
+Date: Fri, 22 Feb 2019 13:06:49 +0100
+Subject: [PATCH] config: Move common parser functions to config_parser.c
+
+This will allow the moved functions to be used in the server side
+configuration parser implementation.
+
+Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+
+CVE:CVE-2023-6004
+Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/commit/?id=79049981a513f9a10fac0f153e9b0b588326021f]
+Signed-off-by: nikhil r <nikhil.r@kpit.com>
+Comment: Removed 1 hunk from config.c as the function was intoduced in
+later version
+
+---
+ include/libssh/config_parser.h | 57 ++++++++
+ src/CMakeLists.txt | 1 +
+ src/config.c | 216 +-----------------------------
+ src/config_parser.c | 238 +++++++++++++++++++++++++++++++++
+ 4 files changed, 297 insertions(+), 215 deletions(-)
+ create mode 100644 include/libssh/config_parser.h
+ create mode 100644 src/config_parser.c
+
+diff --git a/include/libssh/config_parser.h b/include/libssh/config_parser.h
+new file mode 100644
+index 00000000..e974917c
+--- /dev/null
++++ b/include/libssh/config_parser.h
+@@ -0,0 +1,57 @@
++/*
++ * config_parser.h - Common configuration file parser functions
++ *
++ * This file is part of the SSH Library
++ *
++ * Copyright (c) 2019 by Red Hat, Inc.
++ *
++ * Author: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
++ *
++ * The SSH Library is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2.1 of the License, or (at your
++ * option) any later version.
++ *
++ * The SSH Library is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
++ * License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with the SSH Library; see the file COPYING. If not, write to
++ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
++ * MA 02111-1307, USA.
++ */
++
++#ifndef CONFIG_PARSER_H_
++#define CONFIG_PARSER_H_
++
++char *ssh_config_get_cmd(char **str);
++
++char *ssh_config_get_token(char **str);
++
++long ssh_config_get_long(char **str, long notfound);
++
++const char *ssh_config_get_str_tok(char **str, const char *def);
++
++int ssh_config_get_yesno(char **str, int notfound);
++
++/* @brief Parse SSH URI in format [user@]host[:port] from the given string
++ *
++ * @param[in] tok String to parse
++ * @param[out] username Pointer to the location, where the new username will
++ * be stored or NULL if we do not care about the result.
++ * @param[out] hostname Pointer to the location, where the new hostname will
++ * be stored or NULL if we do not care about the result.
++ * @param[out] port Pointer to the location, where the new port will
++ * be stored or NULL if we do not care about the result.
++ *
++ * @returns SSH_OK if the provided string is in format of SSH URI,
++ * SSH_ERROR on failure
++ */
++int ssh_config_parse_uri(const char *tok,
++ char **username,
++ char **hostname,
++ char **port);
++
++#endif /* LIBSSH_CONFIG_H_ */
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index fdb53baf..de66f056 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -163,6 +163,7 @@ set(libssh_SRCS
+ external/poly1305.c
+ external/sc25519.c
+ chachapoly.c
++ config_parser.c
+ )
+
+ if (CMAKE_USE_PTHREADS_INIT)
+diff --git a/src/config.c b/src/config.c
+index 85ecd96a..4268545d 100644
+--- a/src/config.c
++++ b/src/config.c
+@@ -22,7 +22,7 @@
+ */
+
+ #include "config.h"
+-
++#include "libssh/config_parser.h"
+ #include <ctype.h>
+ #include <stdio.h>
+ #include <string.h>
+@@ -228,102 +228,6 @@ static enum ssh_config_opcode_e ssh_config_get_opcode(char *keyword) {
+ return SOC_UNKNOWN;
+ }
+
+-static char *ssh_config_get_cmd(char **str) {
+- register char *c;
+- char *r;
+-
+- /* Ignore leading spaces */
+- for (c = *str; *c; c++) {
+- if (! isblank(*c)) {
+- break;
+- }
+- }
+-
+- if (*c == '\"') {
+- for (r = ++c; *c; c++) {
+- if (*c == '\"') {
+- *c = '\0';
+- goto out;
+- }
+- }
+- }
+-
+- for (r = c; *c; c++) {
+- if (*c == '\n') {
+- *c = '\0';
+- goto out;
+- }
+- }
+-
+-out:
+- *str = c + 1;
+-
+- return r;
+-}
+-
+-static char *ssh_config_get_token(char **str) {
+- register char *c;
+- char *r;
+-
+- c = ssh_config_get_cmd(str);
+-
+- for (r = c; *c; c++) {
+- if (isblank(*c) || *c == '=') {
+- *c = '\0';
+- goto out;
+- }
+- }
+-
+-out:
+- *str = c + 1;
+-
+- return r;
+-}
+-
+-static long ssh_config_get_long(char **str, long notfound) {
+- char *p, *endp;
+- long i;
+-
+- p = ssh_config_get_token(str);
+- if (p && *p) {
+- i = strtol(p, &endp, 10);
+- if (p == endp) {
+- return notfound;
+- }
+- return i;
+- }
+-
+- return notfound;
+-}
+-
+-static const char *ssh_config_get_str_tok(char **str, const char *def) {
+- char *p;
+-
+- p = ssh_config_get_token(str);
+- if (p && *p) {
+- return p;
+- }
+-
+- return def;
+-}
+-
+-static int ssh_config_get_yesno(char **str, int notfound) {
+- const char *p;
+-
+- p = ssh_config_get_str_tok(str, NULL);
+- if (p == NULL) {
+- return notfound;
+- }
+-
+- if (strncasecmp(p, "yes", 3) == 0) {
+- return 1;
+- } else if (strncasecmp(p, "no", 2) == 0) {
+- return 0;
+- }
+-
+- return notfound;
+-}
+-
+ static void local_parse_file(ssh_session session, const char *filename, int *parsing, int seen[]) {
+ FILE *f;
+ char line[MAX_LINE_SIZE] = {0};
+diff --git a/src/config_parser.c b/src/config_parser.c
+new file mode 100644
+index 00000000..ae2aa2c8
+--- /dev/null
++++ b/src/config_parser.c
+@@ -0,0 +1,238 @@
++/*
++ * config_parser.c - Common configuration file parser functions
++ *
++ * This file is part of the SSH Library
++ *
++ * Copyright (c) 2009-2013 by Andreas Schneider <asn@cryptomilk.org>
++ *
++ * The SSH Library is free software; you can redistribute it and/or modify
++ * it under the terms of the GNU Lesser General Public License as published by
++ * the Free Software Foundation; either version 2.1 of the License, or (at your
++ * option) any later version.
++ *
++ * The SSH Library is distributed in the hope that it will be useful, but
++ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
++ * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
++ * License for more details.
++ *
++ * You should have received a copy of the GNU Lesser General Public License
++ * along with the SSH Library; see the file COPYING. If not, write to
++ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
++ * MA 02111-1307, USA.
++ */
++
++#include "config.h"
++
++#include <ctype.h>
++#include <stdio.h>
++#include <string.h>
++#include <stdlib.h>
++
++#include "libssh/config_parser.h"
++#include "libssh/priv.h"
++
++char *ssh_config_get_cmd(char **str)
++{
++ register char *c;
++ char *r;
++
++ /* Ignore leading spaces */
++ for (c = *str; *c; c++) {
++ if (! isblank(*c)) {
++ break;
++ }
++ }
++
++ if (*c == '\"') {
++ for (r = ++c; *c; c++) {
++ if (*c == '\"') {
++ *c = '\0';
++ goto out;
++ }
++ }
++ }
++
++ for (r = c; *c; c++) {
++ if (*c == '\n') {
++ *c = '\0';
++ goto out;
++ }
++ }
++
++out:
++ *str = c + 1;
++
++ return r;
++}
++
++char *ssh_config_get_token(char **str)
++{
++ register char *c;
++ char *r;
++
++ c = ssh_config_get_cmd(str);
++
++ for (r = c; *c; c++) {
++ if (isblank(*c) || *c == '=') {
++ *c = '\0';
++ goto out;
++ }
++ }
++
++out:
++ *str = c + 1;
++
++ return r;
++}
++
++long ssh_config_get_long(char **str, long notfound)
++{
++ char *p, *endp;
++ long i;
++
++ p = ssh_config_get_token(str);
++ if (p && *p) {
++ i = strtol(p, &endp, 10);
++ if (p == endp) {
++ return notfound;
++ }
++ return i;
++ }
++
++ return notfound;
++}
++
++const char *ssh_config_get_str_tok(char **str, const char *def)
++{
++ char *p;
++
++ p = ssh_config_get_token(str);
++ if (p && *p) {
++ return p;
++ }
++
++ return def;
++}
++
++int ssh_config_get_yesno(char **str, int notfound)
++{
++ const char *p;
++
++ p = ssh_config_get_str_tok(str, NULL);
++ if (p == NULL) {
++ return notfound;
++ }
++
++ if (strncasecmp(p, "yes", 3) == 0) {
++ return 1;
++ } else if (strncasecmp(p, "no", 2) == 0) {
++ return 0;
++ }
++
++ return notfound;
++}
++
++int ssh_config_parse_uri(const char *tok,
++ char **username,
++ char **hostname,
++ char **port)
++{
++ char *endp = NULL;
++ long port_n;
++
++ /* Sanitize inputs */
++ if (username != NULL) {
++ *username = NULL;
++ }
++ if (hostname != NULL) {
++ *hostname = NULL;
++ }
++ if (port != NULL) {
++ *port = NULL;
++ }
++
++ /* Username part (optional) */
++ endp = strchr(tok, '@');
++ if (endp != NULL) {
++ /* Zero-length username is not valid */
++ if (tok == endp) {
++ goto error;
++ }
++ if (username != NULL) {
++ *username = strndup(tok, endp - tok);
++ if (*username == NULL) {
++ goto error;
++ }
++ }
++ tok = endp + 1;
++ /* If there is second @ character, this does not look like our URI */
++ endp = strchr(tok, '@');
++ if (endp != NULL) {
++ goto error;
++ }
++ }
++
++ /* Hostname */
++ if (*tok == '[') {
++ /* IPv6 address is enclosed with square brackets */
++ tok++;
++ endp = strchr(tok, ']');
++ if (endp == NULL) {
++ goto error;
++ }
++ } else {
++ /* Hostnames or aliases expand to the last colon or to the end */
++ endp = strrchr(tok, ':');
++ if (endp == NULL) {
++ endp = strchr(tok, '\0');
++ }
++ }
++ if (tok == endp) {
++ /* Zero-length hostnames are not valid */
++ goto error;
++ }
++ if (hostname != NULL) {
++ *hostname = strndup(tok, endp - tok);
++ if (*hostname == NULL) {
++ goto error;
++ }
++ }
++ /* Skip also the closing bracket */
++ if (*endp == ']') {
++ endp++;
++ }
++
++ /* Port (optional) */
++ if (*endp != '\0') {
++ char *port_end = NULL;
++
++ /* Verify the port is valid positive number */
++ port_n = strtol(endp + 1, &port_end, 10);
++ if (port_n < 1 || *port_end != '\0') {
++ SSH_LOG(SSH_LOG_WARN, "Failed to parse port number."
++ " The value '%ld' is invalid or there are some"
++ " trailing characters: '%s'", port_n, port_end);
++ goto error;
++ }
++ if (port != NULL) {
++ *port = strdup(endp + 1);
++ if (*port == NULL) {
++ goto error;
++ }
++ }
++ }
++
++ return SSH_OK;
++
++error:
++ if (username != NULL) {
++ SAFE_FREE(*username);
++ }
++ if (hostname != NULL) {
++ SAFE_FREE(*hostname);
++ }
++ if (port != NULL) {
++ SAFE_FREE(*port);
++ }
++ return SSH_ERROR;
++}
+--
+2.25.1
+
diff --git a/meta-oe/recipes-support/libssh/libssh/001_CVE-2023-6004.patch b/meta-oe/recipes-support/libssh/libssh/001_CVE-2023-6004.patch
new file mode 100644
index 0000000000..e02cae182a
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/001_CVE-2023-6004.patch
@@ -0,0 +1,30 @@
+From a66b4a6eae6614d200a3625862d77565b96a7cd3 Mon Sep 17 00:00:00 2001
+From: Norbert Pocs <norbertpocs0@gmail.com>
+Date: Wed, 1 Nov 2023 11:24:43 +0100
+Subject: [PATCH] CVE-2023-6004: config_parser: Allow multiple '@' in usernames
+
+Signed-off-by: Norbert Pocs <norbertpocs0@gmail.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+Reviewed-by: Jakub Jelen <jjelen@redhat.com>
+
+CVE: CVE-2023-6004
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/a66b4a6eae6614d200a3625862d77565b96a7cd3]
+Signed-off-by: nikhil r <nikhil.r@kpit.com>
+
+---
+ src/config_parser.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/config_parser.c b/src/config_parser.c
+index 0d988fec0..cf83e2c5e 100644
+--- a/src/config_parser.c
++++ b/src/config_parser.c
+@@ -180,7 +180,7 @@ int ssh_config_parse_uri(const char *tok,
+ }
+
+ /* Username part (optional) */
+- endp = strchr(tok, '@');
++ endp = strrchr(tok, '@');
+ if (endp != NULL) {
+ /* Zero-length username is not valid */
+ if (tok == endp) {
diff --git a/meta-oe/recipes-support/libssh/libssh/002_CVE-2023-6004.patch b/meta-oe/recipes-support/libssh/libssh/002_CVE-2023-6004.patch
new file mode 100644
index 0000000000..a77783453a
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/002_CVE-2023-6004.patch
@@ -0,0 +1,83 @@
+From 8615c24647f773a5e04203c7459512715d698be1 Mon Sep 17 00:00:00 2001
+From: Norbert Pocs <norbertpocs0@gmail.com>
+Date: Tue, 31 Oct 2023 09:48:52 +0100
+Subject: [PATCH] CVE-2023-6004: options: Simplify the hostname parsing in
+ ssh_options_set
+
+Using ssh_config_parse_uri can simplify the parsing of the host
+parsing inside the function of ssh_options_set
+
+Signed-off-by: Norbert Pocs <norbertpocs0@gmail.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+Reviewed-by: Jakub Jelen <jjelen@redhat.com>
+
+CVE: CVE-2023-6004
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/8615c24647f773a5e04203c7459512715d698be1]
+Signed-off-by: nikhil r <nikhil.r@kpit.com>
+Comment: Refreshed hunk 2 from option.c
+
+---
+ src/options.c | 40 ++++++++++++++++------------------------
+ 1 file changed, 16 insertions(+), 24 deletions(-)
+
+diff --git a/src/options.c b/src/options.c
+index 6f2c9397e..385114555 100644
+--- a/src/options.c
++++ b/src/options.c
+@@ -36,6 +36,7 @@
+ #include "libssh/session.h"
+ #include "libssh/misc.h"
+ #include "libssh/options.h"
++#include "libssh/config_parser.h"
+ #ifdef WITH_SERVER
+ #include "libssh/server.h"
+ #include "libssh/bind.h"
+@@ -415,33 +416,24 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
+ ssh_set_error_invalid(session);
+ return -1;
+ } else {
+- q = strdup(value);
+- if (q == NULL) {
+- ssh_set_error_oom(session);
++ char *username = NULL, *hostname = NULL, *port = NULL;
++ rc = ssh_config_parse_uri(value, &username, &hostname, &port);
++ if (rc != SSH_OK) {
+ return -1;
+ }
+- p = strchr(q, '@');
+-
+- SAFE_FREE(session->opts.host);
+-
+- if (p) {
+- *p = '\0';
+- session->opts.host = strdup(p + 1);
+- if (session->opts.host == NULL) {
+- SAFE_FREE(q);
+- ssh_set_error_oom(session);
+- return -1;
+- }
+-
++ if (port != NULL) {
++ SAFE_FREE(username);
++ SAFE_FREE(hostname);
++ SAFE_FREE(port);
++ return -1;
++ }
++ if (username != NULL) {
+ SAFE_FREE(session->opts.username);
+- session->opts.username = strdup(q);
+- SAFE_FREE(q);
+- if (session->opts.username == NULL) {
+- ssh_set_error_oom(session);
+- return -1;
+- }
+- } else {
+- session->opts.host = q;
++ session->opts.username = username;
++ }
++ if (hostname != NULL) {
++ SAFE_FREE(session->opts.host);
++ session->opts.host = hostname;
+ }
+ }
+ break;
diff --git a/meta-oe/recipes-support/libssh/libssh/003_CVE-2023-6004.patch b/meta-oe/recipes-support/libssh/libssh/003_CVE-2023-6004.patch
new file mode 100644
index 0000000000..a4e790ed0c
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/003_CVE-2023-6004.patch
@@ -0,0 +1,117 @@
+From c6180409677c765e6b9ae2b18a3a7a9671ac1dbe Mon Sep 17 00:00:00 2001
+From: Norbert Pocs <norbertpocs0@gmail.com>
+Date: Tue, 10 Oct 2023 12:44:16 +0200
+Subject: [PATCH] CVE-2023-6004: misc: Add function to check allowed characters
+ of a hostname
+
+The hostname can be a domain name or an ip address. The colon has to be
+allowed because of IPv6 even it is prohibited in domain names.
+
+Signed-off-by: Norbert Pocs <norbertpocs0@gmail.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+Reviewed-by: Jakub Jelen <jjelen@redhat.com>
+
+CVE: CVE-2023-6004
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/c6180409677c765e6b9ae2b18a3a7a9671ac1dbe]
+Signed-off-by: nikhil r <nikhil.r@kpit.com>
+Comment: Refreshed hunk 1 from misc.h and hunk 2 from misc.c
+---
+ include/libssh/misc.h | 3 ++
+ src/misc.c | 68 +++++++++++++++++++++++++++++++++++++++++++
+ 2 files changed, 71 insertions(+)
+
+diff --git a/include/libssh/misc.h b/include/libssh/misc.h
+index 924da5336..0924ba7fb 100644
+--- a/include/libssh/misc.h
++++ b/include/libssh/misc.h
+@@ -89,4 +89,6 @@ int ssh_match_group(const char *group, const char *object);
+
+ int ssh_quote_file_name(const char *file_name, char *buf, size_t buf_len);
+
++int ssh_check_hostname_syntax(const char *hostname);
++
+ #endif /* MISC_H_ */
+
+diff --git a/src/misc.c b/src/misc.c
+index 7c478a773..be6ee836e 100644
+--- a/src/misc.c
++++ b/src/misc.c
+@@ -94,6 +94,8 @@
+ #define ZLIB_STRING ""
+ #endif
+
++#define ARPA_DOMAIN_MAX_LEN 63
++
+ /**
+ * @defgroup libssh_misc The SSH helper functions.
+ * @ingroup libssh
+@@ -1292,4 +1294,69 @@ error:
+ return SSH_ERROR;
+ }
+
++/**
++ * @brief Checks syntax of a domain name
++ *
++ * The check is made based on the RFC1035 section 2.3.1
++ * Allowed characters are: hyphen, period, digits (0-9) and letters (a-zA-Z)
++ *
++ * The label should be no longer than 63 characters
++ * The label should start with a letter and end with a letter or number
++ * The label in this implementation can start with a number to allow virtual
++ * URLs to pass. Note that this will make IPv4 addresses to pass
++ * this check too.
++ *
++ * @param hostname The domain name to be checked, has to be null terminated
++ *
++ * @return SSH_OK if the hostname passes syntax check
++ * SSH_ERROR otherwise or if hostname is NULL or empty string
++ */
++int ssh_check_hostname_syntax(const char *hostname)
++{
++ char *it = NULL, *s = NULL, *buf = NULL;
++ size_t it_len;
++ char c;
++
++ if (hostname == NULL || strlen(hostname) == 0) {
++ return SSH_ERROR;
++ }
++
++ /* strtok_r writes into the string, keep the input clean */
++ s = strdup(hostname);
++ if (s == NULL) {
++ return SSH_ERROR;
++ }
++
++ it = strtok_r(s, ".", &buf);
++ /* if the token has 0 length */
++ if (it == NULL) {
++ free(s);
++ return SSH_ERROR;
++ }
++ do {
++ it_len = strlen(it);
++ if (it_len > ARPA_DOMAIN_MAX_LEN ||
++ /* the first char must be a letter, but some virtual urls start
++ * with a number */
++ isalnum(it[0]) == 0 ||
++ isalnum(it[it_len - 1]) == 0) {
++ free(s);
++ return SSH_ERROR;
++ }
++ while (*it != '\0') {
++ c = *it;
++ /* the "." is allowed too, but tokenization removes it from the
++ * string */
++ if (isalnum(c) == 0 && c != '-') {
++ free(s);
++ return SSH_ERROR;
++ }
++ it++;
++ }
++ } while ((it = strtok_r(NULL, ".", &buf)) != NULL);
++
++ free(s);
++
++ return SSH_OK;
++}
+ /** @} */
diff --git a/meta-oe/recipes-support/libssh/libssh/004_CVE-2023-6004.patch b/meta-oe/recipes-support/libssh/libssh/004_CVE-2023-6004.patch
new file mode 100644
index 0000000000..39e6d94788
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/004_CVE-2023-6004.patch
@@ -0,0 +1,57 @@
+From 22492b69bba22b102342afc574800d354a08e405 Mon Sep 17 00:00:00 2001
+From: Norbert Pocs <norbertpocs0@gmail.com>
+Date: Tue, 10 Oct 2023 18:33:56 +0200
+Subject: [PATCH] CVE-2023-6004: config_parser: Check for valid syntax of a
+ hostname if it is a domain name
+
+This prevents code injection.
+The domain name syntax checker is based on RFC1035.
+
+Signed-off-by: Norbert Pocs <norbertpocs0@gmail.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+Reviewed-by: Jakub Jelen <jjelen@redhat.com>
+
+CVE: CVE-2023-6004
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/22492b69bba22b102342afc574800d354a08e405]
+Signed-off-by: nikhil r <nikhil.r@kpit.com>
+Comment: Refreshed hunk 2 and 3 from config_parser.c
+
+---
+ src/config_parser.c | 12 +++++++++++-
+ 1 file changed, 11 insertions(+), 1 deletion(-)
+
+diff --git a/src/config_parser.c b/src/config_parser.c
+index cf83e2c5e..b8b94611a 100644
+--- a/src/config_parser.c
++++ b/src/config_parser.c
+@@ -30,6 +30,7 @@
+
+ #include "libssh/config_parser.h"
+ #include "libssh/priv.h"
++#include "libssh/misc.h"
+
+ char *ssh_config_get_cmd(char **str)
+ {
+@@ -139,6 +140,7 @@ int ssh_config_parse_uri(const char *tok,
+ {
+ char *endp = NULL;
+ long port_n;
++ int rc;
+
+ /* Sanitize inputs */
+ if (username != NULL) {
+@@ -196,6 +198,14 @@ int ssh_config_parse_uri(const char *tok,
+ if (*hostname == NULL) {
+ goto error;
+ }
++ /* if not an ip, check syntax */
++ rc = ssh_is_ipaddr(*hostname);
++ if (rc == 0) {
++ rc = ssh_check_hostname_syntax(*hostname);
++ if (rc != SSH_OK) {
++ goto error;
++ }
++ }
+ }
+ /* Skip also the closing bracket */
+ if (*endp == ']') {
diff --git a/meta-oe/recipes-support/libssh/libssh/005_CVE-2023-6004.patch b/meta-oe/recipes-support/libssh/libssh/005_CVE-2023-6004.patch
new file mode 100644
index 0000000000..c86aba4d88
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/005_CVE-2023-6004.patch
@@ -0,0 +1,142 @@
+From cea841d71c025f9c998b7d5fc9f2a2839df62921 Mon Sep 17 00:00:00 2001
+From: Norbert Pocs <norbertpocs0@gmail.com>
+Date: Tue, 28 Nov 2023 15:26:45 +0100
+Subject: [PATCH] CVE-2023-6004 misc: Add ipv6 link-local check for an ip
+ address
+
+Signed-off-by: Norbert Pocs <norbertpocs0@gmail.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+Reviewed-by: Jakub Jelen <jjelen@redhat.com>
+
+CVE: CVE-2023-6004
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/cea841d71c025f9c998b7d5fc9f2a2839df62921]
+Signed-off-by: nikhil r <nikhil.r@kpit.com>
+Comment: Refreshed hunk 1 from CMakeLists.txt, hunk 1 from connect.c and
+hunks 2,3,4 from misc.c
+---
+ src/CMakeLists.txt | 1 +
+ src/connect.c | 2 +-
+ src/misc.c | 44 ++++++++++++++++++++++++++++++++++++++------
+ 3 files changed, 40 insertions(+), 7 deletions(-)
+
+diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
+index d6245c0db..807313b59 100644
+--- a/src/CMakeLists.txt
++++ b/src/CMakeLists.txt
+@@ -14,6 +14,7 @@ set(LIBSSH_LINK_LIBRARIES
+ if (WIN32)
+ set(LIBSSH_LINK_LIBRARIES
+ ${LIBSSH_LINK_LIBRARIES}
++ iphlpapi
+ ws2_32
+ )
+ endif (WIN32)
+diff --git a/src/connect.c b/src/connect.c
+index 57e37e634..15cae6444 100644
+--- a/src/connect.c
++++ b/src/connect.c
+@@ -130,7 +130,7 @@ static int getai(const char *host, int port, struct addrinfo **ai) {
+ #endif
+ }
+
+- if (ssh_is_ipaddr(host)) {
++ if (ssh_is_ipaddr(host) == 1) {
+ /* this is an IP address */
+ SSH_LOG(SSH_LOG_PACKET,"host %s matches an IP address",host);
+ hints.ai_flags |= AI_NUMERICHOST;
+diff --git a/src/misc.c b/src/misc.c
+index be6ee836e..7081f12ae 100644
+--- a/src/misc.c
++++ b/src/misc.c
+@@ -32,6 +32,7 @@
+ #include <sys/socket.h>
+ #include <netinet/in.h>
+ #include <arpa/inet.h>
++#include <net/if.h>
+
+ #endif /* _WIN32 */
+
+@@ -59,6 +60,7 @@
+ #include <ws2tcpip.h>
+ #include <shlobj.h>
+ #include <direct.h>
++#include <netioapi.h>
+
+ #ifdef HAVE_IO_H
+ #include <io.h>
+@@ -191,22 +191,37 @@ int ssh_is_ipaddr_v4(const char *str) {
+
+ int ssh_is_ipaddr(const char *str) {
+ int rc = SOCKET_ERROR;
++ char *s = strdup(str);
+
+- if (strchr(str, ':')) {
++ if (s == NULL) {
++ return -1;
++ }
++ if (strchr(s, ':')) {
+ struct sockaddr_storage ss;
+ int sslen = sizeof(ss);
++ char *network_interface = strchr(s, '%');
+
+- /* TODO link-local (IP:v6:addr%ifname). */
+- rc = WSAStringToAddressA((LPSTR) str,
++ /* link-local (IP:v6:addr%ifname). */
++ if (network_interface != NULL) {
++ rc = if_nametoindex(network_interface + 1);
++ if (rc == 0) {
++ free(s);
++ return 0;
++ }
++ *network_interface = '\0';
++ }
++ rc = WSAStringToAddressA((LPSTR) s,
+ AF_INET6,
+ NULL,
+ (struct sockaddr*)&ss,
+ &sslen);
+ if (rc == 0) {
++ free(s);
+ return 1;
+ }
+ }
+
++ free(s);
+ return ssh_is_ipaddr_v4(str);
+ }
+ #else /* _WIN32 */
+@@ -285,17 +300,32 @@ int ssh_is_ipaddr_v4(const char *str) {
+
+ int ssh_is_ipaddr(const char *str) {
+ int rc = -1;
++ char *s = strdup(str);
+
+- if (strchr(str, ':')) {
++ if (s == NULL) {
++ return -1;
++ }
++ if (strchr(s, ':')) {
+ struct in6_addr dest6;
++ char *network_interface = strchr(s, '%');
+
+- /* TODO link-local (IP:v6:addr%ifname). */
+- rc = inet_pton(AF_INET6, str, &dest6);
++ /* link-local (IP:v6:addr%ifname). */
++ if (network_interface != NULL) {
++ rc = if_nametoindex(network_interface + 1);
++ if (rc == 0) {
++ free(s);
++ return 0;
++ }
++ *network_interface = '\0';
++ }
++ rc = inet_pton(AF_INET6, s, &dest6);
+ if (rc > 0) {
++ free(s);
+ return 1;
+ }
+ }
+
++ free(s);
+ return ssh_is_ipaddr_v4(str);
+ }
diff --git a/meta-oe/recipes-support/libssh/libssh/006_CVE-2023-6004.patch b/meta-oe/recipes-support/libssh/libssh/006_CVE-2023-6004.patch
new file mode 100644
index 0000000000..f3cb2b998e
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/006_CVE-2023-6004.patch
@@ -0,0 +1,117 @@
+From 1a02364b5107a4125ea3cb76fcdb6beabaebf3be Mon Sep 17 00:00:00 2001
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Fri, 22 Dec 2023 10:32:40 +0100
+Subject: [PATCH] Fix regression in IPv6 addresses in hostname parsing
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+(cherry picked from commit 4f997aee7c7d7ea346b3e8ba505da0b7601ff318)
+
+CVE: CVE-2023-6004
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/1a02364b5107a4125ea3cb76fcdb6beabaebf3be]
+Signed-off-by: nikhil r <nikhil.r@kpit.com>
+Comment: Removed 1 hunk from config_parser.c as the function was intoduced in
+later version
+
+---
+ include/libssh/config_parser.h | 11 ++++++++---
+ src/config.c | 4 ++--
+ src/config_parser.c | 16 +++++++++++-----
+ src/options.c | 10 ++--------
+ 4 files changed, 23 insertions(+), 18 deletions(-)
+
+diff --git a/include/libssh/config_parser.h b/include/libssh/config_parser.h
+index a7dd42a2c..ca353432b 100644
+--- a/include/libssh/config_parser.h
++++ b/include/libssh/config_parser.h
+@@ -26,6 +26,8 @@
+ #ifndef CONFIG_PARSER_H_
+ #define CONFIG_PARSER_H_
+
++#include <stdbool.h>
++
+ char *ssh_config_get_cmd(char **str);
+
+ char *ssh_config_get_token(char **str);
+@@ -45,13 +47,16 @@ int ssh_config_get_yesno(char **str, int notfound);
+ * be stored or NULL if we do not care about the result.
+ * @param[out] port Pointer to the location, where the new port will
+ * be stored or NULL if we do not care about the result.
++ * @param[in] ignore_port Set to true if the we should not attempt to parse
++ * port number.
+ *
+ * @returns SSH_OK if the provided string is in format of SSH URI,
+ * SSH_ERROR on failure
+ */
+ int ssh_config_parse_uri(const char *tok,
+- char **username,
+- char **hostname,
+- char **port);
++ char **username,
++ char **hostname,
++ char **port,
++ bool ignore_port);
+
+ #endif /* LIBSSH_CONFIG_H_ */
+diff --git a/src/config_parser.c b/src/config_parser.c
+index b8b94611a..d4b2d2c3b 100644
+--- a/src/config_parser.c
++++ b/src/config_parser.c
+@@ -162,9 +162,10 @@ int ssh_config_get_yesno(char **str, int notfound)
+ }
+
+ int ssh_config_parse_uri(const char *tok,
+- char **username,
+- char **hostname,
+- char **port)
++ char **username,
++ char **hostname,
++ char **port,
++ bool ignore_port)
+ {
+ char *endp = NULL;
+ long port_n;
+@@ -210,12 +211,17 @@ int ssh_config_parse_uri(const char *tok,
+ if (endp == NULL) {
+ goto error;
+ }
+- } else {
+- /* Hostnames or aliases expand to the last colon or to the end */
++ } else if (!ignore_port) {
++ /* Hostnames or aliases expand to the last colon (if port is requested)
++ * or to the end */
+ endp = strrchr(tok, ':');
+ if (endp == NULL) {
+ endp = strchr(tok, '\0');
+ }
++ } else {
++ /* If no port is requested, expand to the end of line
++ * (to accommodate the IPv6 addresses) */
++ endp = strchr(tok, '\0');
+ }
+ if (tok == endp) {
+ /* Zero-length hostnames are not valid */
+diff --git a/src/options.c b/src/options.c
+index 385114555..b3ecffe15 100644
+--- a/src/options.c
++++ b/src/options.c
+@@ -416,17 +416,11 @@ int ssh_options_set(ssh_session session, enum ssh_options_e type,
+ ssh_set_error_invalid(session);
+ return -1;
+ } else {
+- char *username = NULL, *hostname = NULL, *port = NULL;
+- rc = ssh_config_parse_uri(value, &username, &hostname, &port);
++ char *username = NULL, *hostname = NULL;
++ rc = ssh_config_parse_uri(value, &username, &hostname, NULL, true);
+ if (rc != SSH_OK) {
+ return -1;
+ }
+- if (port != NULL) {
+- SAFE_FREE(username);
+- SAFE_FREE(hostname);
+- SAFE_FREE(port);
+- return -1;
+- }
+ if (username != NULL) {
+ SAFE_FREE(session->opts.username);
+ session->opts.username = username;
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2020-16135.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2020-16135.patch
new file mode 100644
index 0000000000..63b78688dd
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2020-16135.patch
@@ -0,0 +1,44 @@
+From 0a9268a60f2d3748ca69bde5651f20e72761058c Mon Sep 17 00:00:00 2001
+From: Andreas Schneider <asn@cryptomilk.org>
+Date: Wed, 3 Jun 2020 10:04:09 +0200
+Subject: CVE-2020-16135: Add missing NULL check for ssh_buffer_new()
+
+Add a missing NULL check for the pointer returned by ssh_buffer_new() in
+sftpserver.c.
+
+Thanks to Ramin Farajpour Cami for spotting this.
+
+Fixes T232
+
+Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
+Reviewed-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
+Reviewed-by: Jakub Jelen <jjelen@redhat.com>
+(cherry picked from commit 533d881b0f4b24c72b35ecc97fa35d295d063e53)
+
+Upstream-Status: Backport [https://git.libssh.org/projects/libssh.git/patch/?id=0a9268a60f2d3748ca69bde5651f20e72761058c]
+CVE: CVE-2020-16135
+Signed-off-by: Hitendra Prajapati <hprajapati@mvista.com>
+---
+ src/sftpserver.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/sftpserver.c b/src/sftpserver.c
+index 1717aa417..1af8a0e76 100644
+--- a/src/sftpserver.c
++++ b/src/sftpserver.c
+@@ -64,6 +64,12 @@ sftp_client_message sftp_get_client_message(sftp_session sftp) {
+
+ /* take a copy of the whole packet */
+ msg->complete_message = ssh_buffer_new();
++ if (msg->complete_message == NULL) {
++ ssh_set_error_oom(session);
++ sftp_client_message_free(msg);
++ return NULL;
++ }
++
+ ssh_buffer_add_data(msg->complete_message,
+ ssh_buffer_get(payload),
+ ssh_buffer_get_len(payload));
+--
+2.25.1
+
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-1.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-1.patch
new file mode 100644
index 0000000000..413e5b3d11
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-1.patch
@@ -0,0 +1,385 @@
+From 4cef5e965a46e9271aed62631b152e4bd23c1e3c Mon Sep 17 00:00:00 2001
+From: Aris Adamantiadis <aris@0xbadc0de.be>
+Date: Tue, 12 Dec 2023 23:09:57 +0100
+Subject: [PATCH] CVE-2023-48795: client side mitigation
+
+Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/4cef5e965a46e9271aed62631b152e4bd23c1e3c]
+CVE: CVE-2023-48795
+Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
+---
+ include/libssh/packet.h | 1 +
+ include/libssh/session.h | 6 +++++
+ src/curve25519.c | 18 +++----------
+ src/dh.c | 6 +----
+ src/ecdh.c | 7 +----
+ src/ecdh_crypto.c | 10 ++-----
+ src/ecdh_gcrypt.c | 10 +++----
+ src/ecdh_mbedcrypto.c | 11 +++-----
+ src/kex.c | 34 ++++++++++++++++++++----
+ src/packet.c | 56 +++++++++++++++++++++++++++++++++++++++-
+ src/packet_cb.c | 12 +++++++++
+ 11 files changed, 118 insertions(+), 53 deletions(-)
+
+diff --git a/include/libssh/packet.h b/include/libssh/packet.h
+index fbe09700..8800e16b 100644
+--- a/include/libssh/packet.h
++++ b/include/libssh/packet.h
+@@ -63,6 +63,7 @@ SSH_PACKET_CALLBACK(ssh_packet_ext_info);
+ SSH_PACKET_CALLBACK(ssh_packet_kexdh_init);
+ #endif
+
++int ssh_packet_send_newkeys(ssh_session session);
+ int ssh_packet_send_unimplemented(ssh_session session, uint32_t seqnum);
+ int ssh_packet_parse_type(ssh_session session);
+ //int packet_flush(ssh_session session, int enforce_blocking);
+diff --git a/include/libssh/session.h b/include/libssh/session.h
+index 23633cc2..b8810f54 100644
+--- a/include/libssh/session.h
++++ b/include/libssh/session.h
+@@ -69,6 +69,12 @@ enum ssh_pending_call_e {
+ /* Client successfully authenticated */
+ #define SSH_SESSION_FLAG_AUTHENTICATED 2
+
++/* The current SSH2 session implements the "strict KEX" feature and should behave
++ * differently on SSH2_MSG_NEWKEYS. */
++#define SSH_SESSION_FLAG_KEX_STRICT 0x0010
++/* Unexpected packets have been sent while the session was still unencrypted */
++#define SSH_SESSION_FLAG_KEX_TAINTED 0x0020
++
+ /* codes to use with ssh_handle_packets*() */
+ /* Infinite timeout */
+ #define SSH_TIMEOUT_INFINITE -1
+diff --git a/src/curve25519.c b/src/curve25519.c
+index 167209f4..6eda5feb 100644
+--- a/src/curve25519.c
++++ b/src/curve25519.c
+@@ -166,12 +166,7 @@ int ssh_client_curve25519_reply(ssh_session session, ssh_buffer packet){
+ }
+
+ /* Send the MSG_NEWKEYS */
+- if (ssh_buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS) < 0) {
+- goto error;
+- }
+-
+- rc=ssh_packet_send(session);
+- SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
++ rc = ssh_packet_send_newkeys(session);
+ return rc;
+ error:
+ return SSH_ERROR;
+@@ -297,15 +292,10 @@ int ssh_server_curve25519_init(ssh_session session, ssh_buffer packet){
+ return SSH_ERROR;
+ }
+
+- /* Send the MSG_NEWKEYS */
+- rc = ssh_buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS);
+- if (rc < 0) {
+- goto error;
+- }
+-
+ session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
+- rc = ssh_packet_send(session);
+- SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
++
++ /* Send the MSG_NEWKEYS */
++ rc = ssh_packet_send_newkeys(session);
+
+ return rc;
+ error:
+diff --git a/src/dh.c b/src/dh.c
+index cc12fd46..33883f2d 100644
+--- a/src/dh.c
++++ b/src/dh.c
+@@ -735,11 +735,7 @@ int ssh_client_dh_reply(ssh_session session, ssh_buffer packet){
+ }
+
+ /* Send the MSG_NEWKEYS */
+- if (ssh_buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS) < 0) {
+- goto error;
+- }
+-
+- rc=ssh_packet_send(session);
++ rc = ssh_packet_send_newkeys(session);
+ SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
+ return rc;
+ error:
+diff --git a/src/ecdh.c b/src/ecdh.c
+index f7fcaf13..1fef7ec9 100644
+--- a/src/ecdh.c
++++ b/src/ecdh.c
+@@ -72,12 +72,7 @@ int ssh_client_ecdh_reply(ssh_session session, ssh_buffer packet){
+ }
+
+ /* Send the MSG_NEWKEYS */
+- if (ssh_buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS) < 0) {
+- goto error;
+- }
+-
+- rc=ssh_packet_send(session);
+- SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
++ rc = ssh_packet_send_newkeys(session);
+ return rc;
+ error:
+ return SSH_ERROR;
+diff --git a/src/ecdh_crypto.c b/src/ecdh_crypto.c
+index 24f21c03..7e5f0cc7 100644
+--- a/src/ecdh_crypto.c
++++ b/src/ecdh_crypto.c
+@@ -318,15 +318,9 @@ int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet){
+ return SSH_ERROR;
+ }
+
+- /* Send the MSG_NEWKEYS */
+- rc = ssh_buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS);
+- if (rc < 0) {
+- return SSH_ERROR;;
+- }
+-
+ session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
+- rc = ssh_packet_send(session);
+- SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
++ /* Send the MSG_NEWKEYS */
++ rc = ssh_packet_send_newkeys(session);
+
+ return rc;
+ }
+diff --git a/src/ecdh_gcrypt.c b/src/ecdh_gcrypt.c
+index e43cacea..c1db7f5d 100644
+--- a/src/ecdh_gcrypt.c
++++ b/src/ecdh_gcrypt.c
+@@ -362,17 +362,13 @@ int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet) {
+ goto out;
+ }
+
+-
++ session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
+ /* Send the MSG_NEWKEYS */
+- rc = ssh_buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS);
+- if (rc != SSH_OK) {
++ rc = ssh_packet_send_newkeys(session);
++ if (rc == SSH_ERROR) {
+ goto out;
+ }
+
+- session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
+- rc = ssh_packet_send(session);
+- SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
+-
+ out:
+ gcry_sexp_release(param);
+ gcry_sexp_release(key);
+diff --git a/src/ecdh_mbedcrypto.c b/src/ecdh_mbedcrypto.c
+index fa350028..24924508 100644
+--- a/src/ecdh_mbedcrypto.c
++++ b/src/ecdh_mbedcrypto.c
+@@ -293,16 +293,13 @@ int ssh_server_ecdh_init(ssh_session session, ssh_buffer packet)
+ goto out;
+ }
+
+- rc = ssh_buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS);
+- if (rc < 0) {
+- rc = SSH_ERROR;
++ session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
++ /* Send the MSG_NEWKEYS */
++ rc = ssh_packet_send_newkeys(session);
++ if (rc == SSH_ERROR) {
+ goto out;
+ }
+
+- session->dh_handshake_state = DH_STATE_NEWKEYS_SENT;
+- rc = ssh_packet_send(session);
+- SSH_LOG(SSH_LOG_PROTOCOL, "SSH_MSG_NEWKEYS sent");
+-
+ out:
+ mbedtls_ecp_group_free(&grp);
+ return rc;
+diff --git a/src/kex.c b/src/kex.c
+index 82686e4b..7f1bb324 100644
+--- a/src/kex.c
++++ b/src/kex.c
+@@ -105,6 +105,9 @@
+
+ /* RFC 8308 */
+ #define KEX_EXTENSION_CLIENT "ext-info-c"
++/* Strict kex mitigation against CVE-2023-48795 */
++#define KEX_STRICT_CLIENT "kex-strict-c-v00@openssh.com"
++#define KEX_STRICT_SERVER "kex-strict-s-v00@openssh.com"
+
+ /* NOTE: This is a fixed API and the index is defined by ssh_kex_types_e */
+ static const char *default_methods[] = {
+@@ -521,6 +524,27 @@ SSH_PACKET_CALLBACK(ssh_packet_kexinit){
+ goto error;
+ }
+
++ /*
++ * handle the "strict KEX" feature. If supported by peer, then set up the
++ * flag and verify packet sequence numbers.
++ */
++ if (server_kex) {
++ ok = ssh_match_group(session->next_crypto->client_kex.methods[SSH_KEX],
++ KEX_STRICT_CLIENT);
++ if (ok) {
++ SSH_LOG(SSH_LOG_DEBUG, "Client supports strict kex, enabling.");
++ session->flags |= SSH_SESSION_FLAG_KEX_STRICT;
++ }
++ } else {
++ /* client kex */
++ ok = ssh_match_group(session->next_crypto->server_kex.methods[SSH_KEX],
++ KEX_STRICT_SERVER);
++ if (ok) {
++ SSH_LOG(SSH_LOG_DEBUG, "Server supports strict kex, enabling.");
++ session->flags |= SSH_SESSION_FLAG_KEX_STRICT;
++ }
++ }
++
+ /*
+ * If client sent a ext-info-c message in the kex list, it supports
+ * RFC 8308 extension negotiation.
+@@ -778,21 +802,21 @@ int ssh_set_client_kex(ssh_session session)
+ return SSH_OK;
+ }
+
+- /* Here we append ext-info-c to the list of kex algorithms */
++ /* Here we append ext-info-c and kex-strict-c-v00@openssh.com to the list of kex algorithms */
+ kex = client->methods[SSH_KEX];
+ len = strlen(kex);
+- if (len + strlen(KEX_EXTENSION_CLIENT) + 2 < len) {
++ /* Comma, comma, nul byte */
++ kex_len = len + 1 + strlen(KEX_EXTENSION_CLIENT) + 1 + strlen(KEX_STRICT_CLIENT ) + 1;
++ if (kex_len >= MAX_PACKET_LEN) {
+ /* Overflow */
+ return SSH_ERROR;
+ }
+- kex_len = len + strlen(KEX_EXTENSION_CLIENT) + 2; /* comma, NULL */
+ kex_tmp = realloc(kex, kex_len);
+ if (kex_tmp == NULL) {
+- free(kex);
+ ssh_set_error_oom(session);
+ return SSH_ERROR;
+ }
+- snprintf(kex_tmp + len, kex_len - len, ",%s", KEX_EXTENSION_CLIENT);
++ snprintf(kex_tmp + len, kex_len - len, ",%s,%s", KEX_EXTENSION_CLIENT, KEX_STRICT_CLIENT);
+ client->methods[SSH_KEX] = kex_tmp;
+
+ return SSH_OK;
+diff --git a/src/packet.c b/src/packet.c
+index 61a44237..8025a7ff 100644
+--- a/src/packet.c
++++ b/src/packet.c
+@@ -1126,6 +1126,19 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
+ }
+ #endif /* WITH_ZLIB */
+ payloadsize = ssh_buffer_get_len(session->in_buffer);
++ if (session->recv_seq == UINT32_MAX) {
++ /* Overflowing sequence numbers is always fishy */
++ if (session->current_crypto == NULL) {
++ /* don't allow sequence number overflow when unencrypted */
++ ssh_set_error(session,
++ SSH_FATAL,
++ "Incoming sequence number overflow");
++ goto error;
++ } else {
++ SSH_LOG(SSH_LOG_WARNING,
++ "Incoming sequence number overflow");
++ }
++ }
+ session->recv_seq++;
+ if (session->raw_counter != NULL) {
+ session->raw_counter->in_bytes += payloadsize;
+@@ -1141,7 +1154,19 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
+ SSH_LOG(SSH_LOG_PACKET,
+ "packet: read type %hhd [len=%d,padding=%hhd,comp=%d,payload=%d]",
+ session->in_packet.type, packet_len, padding, compsize, payloadsize);
+-
++ if (session->current_crypto == NULL) {
++ /* In strict kex, only a few packets are allowed. Taint the session
++ * if we received packets that are normally allowed but to be
++ * refused if we are in strict kex when KEX is over.
++ */
++ uint8_t type = session->in_packet.type;
++
++ if (type != SSH2_MSG_KEXINIT && type != SSH2_MSG_NEWKEYS &&
++ (type < SSH2_MSG_KEXDH_INIT ||
++ type > SSH2_MSG_KEX_DH_GEX_REQUEST)) {
++ session->flags |= SSH_SESSION_FLAG_KEX_TAINTED;
++ }
++ }
+ /* Check if the packet is expected */
+ filter_result = ssh_packet_incoming_filter(session);
+
+@@ -1153,6 +1178,9 @@ int ssh_packet_socket_callback(const void *data, size_t receivedlen, void *user)
+ case SSH_PACKET_DENIED:
+ goto error;
+ case SSH_PACKET_UNKNOWN:
++ if (session->current_crypto == NULL) {
++ session->flags |= SSH_SESSION_FLAG_KEX_TAINTED;
++ }
+ ssh_packet_send_unimplemented(session, session->recv_seq - 1);
+ break;
+ }
+@@ -1276,9 +1304,35 @@ void ssh_packet_process(ssh_session session, uint8_t type){
+ if(r==SSH_PACKET_NOT_USED){
+ SSH_LOG(SSH_LOG_RARE,"Couldn't do anything with packet type %d",type);
+ ssh_packet_send_unimplemented(session, session->recv_seq-1);
++ if (session->current_crypto == NULL) {
++ session->flags |= SSH_SESSION_FLAG_KEX_TAINTED;
++ }
+ }
+ }
+
++/** @internal
++ * @brief sends a SSH_MSG_NEWKEYS when enabling the new negotiated ciphers
++ * @param session the SSH session
++ * @return SSH_ERROR on error, else SSH_OK
++ */
++int ssh_packet_send_newkeys(ssh_session session)
++{
++ int rc;
++
++ /* Send the MSG_NEWKEYS */
++ rc = ssh_buffer_add_u8(session->out_buffer, SSH2_MSG_NEWKEYS);
++ if (rc < 0) {
++ return rc;
++ }
++
++ rc = ssh_packet_send(session);
++ if (rc == SSH_ERROR) {
++ return rc;
++ }
++ SSH_LOG(SSH_LOG_DEBUG, "SSH_MSG_NEWKEYS sent");
++ return rc;
++}
++
+ /** @internal
+ * @brief sends a SSH_MSG_UNIMPLEMENTED answer to an unhandled packet
+ * @param session the SSH session
+diff --git a/src/packet_cb.c b/src/packet_cb.c
+index 6aa64766..de03fb07 100644
+--- a/src/packet_cb.c
++++ b/src/packet_cb.c
+@@ -154,6 +154,18 @@ SSH_PACKET_CALLBACK(ssh_packet_newkeys){
+ goto error;
+ }
+
++ if (session->flags & SSH_SESSION_FLAG_KEX_STRICT) {
++ /* reset packet sequence number when running in strict kex mode */
++ session->recv_seq = 0;
++ /* Check that we aren't tainted */
++ if (session->flags & SSH_SESSION_FLAG_KEX_TAINTED) {
++ ssh_set_error(session,
++ SSH_FATAL,
++ "Received unexpected packets in strict KEX mode.");
++ goto error;
++ }
++}
++
+ if(session->server){
+ /* server things are done in server.c */
+ session->dh_handshake_state=DH_STATE_FINISHED;
+--
+2.25.1
+
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-2.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-2.patch
new file mode 100644
index 0000000000..fe3300503f
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-2.patch
@@ -0,0 +1,126 @@
+From 0870c8db28be9eb457ee3d4f9a168959d9507efd Mon Sep 17 00:00:00 2001
+From: Aris Adamantiadis <aris@0xbadc0de.be>
+Date: Tue, 12 Dec 2023 23:30:26 +0100
+Subject: [PATCH] CVE-2023-48795: Server side mitigations
+
+Signed-off-by: Aris Adamantiadis <aris@0xbadc0de.be>
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/0870c8db28be9eb457ee3d4f9a168959d9507efd]
+CVE: CVE-2023-48795
+Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
+---
+ include/libssh/kex.h | 1 +
+ src/kex.c | 46 ++++++++++++++++++++++++++++++++++----------
+ src/server.c | 8 +++++++-
+ 3 files changed, 44 insertions(+), 11 deletions(-)
+
+diff --git a/include/libssh/kex.h b/include/libssh/kex.h
+index a626d105..2b1a74d5 100644
+--- a/include/libssh/kex.h
++++ b/include/libssh/kex.h
+@@ -36,6 +36,7 @@ SSH_PACKET_CALLBACK(ssh_packet_kexinit);
+ int ssh_send_kex(ssh_session session, int server_kex);
+ void ssh_list_kex(struct ssh_kex_struct *kex);
+ int ssh_set_client_kex(ssh_session session);
++int ssh_kex_append_extensions(ssh_session session, struct ssh_kex_struct *pkex);
+ int ssh_kex_select_methods(ssh_session session);
+ int ssh_verify_existing_algo(enum ssh_kex_types_e algo, const char *name);
+ char *ssh_keep_known_algos(enum ssh_kex_types_e algo, const char *list);
+diff --git a/src/kex.c b/src/kex.c
+index 2ed90235..b03e6484 100644
+--- a/src/kex.c
++++ b/src/kex.c
+@@ -766,11 +766,8 @@ int ssh_set_client_kex(ssh_session session)
+ {
+ struct ssh_kex_struct *client= &session->next_crypto->client_kex;
+ const char *wanted;
+- char *kex = NULL;
+- char *kex_tmp = NULL;
+ int ok;
+ int i;
+- size_t kex_len, len;
+
+ ok = ssh_get_random(client->cookie, 16, 0);
+ if (!ok) {
+@@ -802,11 +799,33 @@ int ssh_set_client_kex(ssh_session session)
+ return SSH_OK;
+ }
+
+- /* Here we append ext-info-c and kex-strict-c-v00@openssh.com to the list of kex algorithms */
+- kex = client->methods[SSH_KEX];
++ ok = ssh_kex_append_extensions(session, client);
++ if (ok != SSH_OK){
++ return ok;
++ }
++
++ return SSH_OK;
++}
++
++int ssh_kex_append_extensions(ssh_session session, struct ssh_kex_struct *pkex)
++{
++ char *kex = NULL;
++ char *kex_tmp = NULL;
++ size_t kex_len, len;
++
++ /* Here we append ext-info-c and kex-strict-c-v00@openssh.com for client
++ * and kex-strict-s-v00@openssh.com for server to the list of kex algorithms
++ */
++ kex = pkex->methods[SSH_KEX];
+ len = strlen(kex);
+- /* Comma, comma, nul byte */
+- kex_len = len + 1 + strlen(KEX_EXTENSION_CLIENT) + 1 + strlen(KEX_STRICT_CLIENT ) + 1;
++ if (session->server) {
++ /* Comma, nul byte */
++ kex_len = len + 1 + strlen(KEX_STRICT_SERVER) + 1;
++ } else {
++ /* Comma, comma, nul byte */
++ kex_len = len + 1 + strlen(KEX_EXTENSION_CLIENT) + 1 +
++ strlen(KEX_STRICT_CLIENT) + 1;
++ }
+ if (kex_len >= MAX_PACKET_LEN) {
+ /* Overflow */
+ return SSH_ERROR;
+@@ -816,9 +835,16 @@ int ssh_set_client_kex(ssh_session session)
+ ssh_set_error_oom(session);
+ return SSH_ERROR;
+ }
+- snprintf(kex_tmp + len, kex_len - len, ",%s,%s", KEX_EXTENSION_CLIENT, KEX_STRICT_CLIENT);
+- client->methods[SSH_KEX] = kex_tmp;
+-
++ if (session->server){
++ snprintf(kex_tmp + len, kex_len - len, ",%s", KEX_STRICT_SERVER);
++ } else {
++ snprintf(kex_tmp + len,
++ kex_len - len,
++ ",%s,%s",
++ KEX_EXTENSION_CLIENT,
++ KEX_STRICT_CLIENT);
++ }
++ pkex->methods[SSH_KEX] = kex_tmp;
+ return SSH_OK;
+ }
+
+diff --git a/src/server.c b/src/server.c
+index bc98da4f..f3d24a7b 100644
+--- a/src/server.c
++++ b/src/server.c
+@@ -158,7 +158,13 @@ static int server_set_kex(ssh_session session) {
+ }
+ }
+
+- return 0;
++ /* Do not append the extensions during rekey */
++ if (session->flags & SSH_SESSION_FLAG_AUTHENTICATED) {
++ return SSH_OK;
++ }
++
++ rc = ssh_kex_append_extensions(session, server);
++ return rc;
+ }
+
+ int ssh_server_init_kex(ssh_session session) {
+--
+2.25.1
+
diff --git a/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-3.patch b/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-3.patch
new file mode 100644
index 0000000000..1635a4c2dc
--- /dev/null
+++ b/meta-oe/recipes-support/libssh/libssh/CVE-2023-48795-3.patch
@@ -0,0 +1,47 @@
+From 5846e57538c750c5ce67df887d09fa99861c79c6 Mon Sep 17 00:00:00 2001
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Thu, 14 Dec 2023 12:22:01 +0100
+Subject: [PATCH] CVE-2023-48795: Strip extensions from both kex lists for
+ matching
+
+Signed-off-by: Jakub Jelen <jjelen@redhat.com>
+Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
+
+Upstream-Status: Backport [https://gitlab.com/libssh/libssh-mirror/-/commit/5846e57538c750c5ce67df887d09fa99861c79c6]
+CVE: CVE-2023-48795
+Signed-off-by: Vijay Anusuri <vanusuri@mvista.com>
+---
+ src/kex.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/src/kex.c b/src/kex.c
+index b03e6484..c100d908 100644
+--- a/src/kex.c
++++ b/src/kex.c
+@@ -857,11 +857,19 @@ int ssh_kex_select_methods (ssh_session session){
+ char *ext_start = NULL;
+ int i;
+
+- /* Here we should drop the ext-info-c from the list so we avoid matching.
++ /* Here we should drop the extensions from the list so we avoid matching.
+ * it. We added it to the end, so we can just truncate the string here */
+- ext_start = strstr(client->methods[SSH_KEX], ","KEX_EXTENSION_CLIENT);
+- if (ext_start != NULL) {
+- ext_start[0] = '\0';
++ if (session->client) {
++ ext_start = strstr(client->methods[SSH_KEX], "," KEX_EXTENSION_CLIENT);
++ if (ext_start != NULL) {
++ ext_start[0] = '\0';
++ }
++ }
++ if (session->server) {
++ ext_start = strstr(server->methods[SSH_KEX], "," KEX_STRICT_SERVER);
++ if (ext_start != NULL) {
++ ext_start[0] = '\0';
++ }
+ }
+
+ for (i = 0; i < KEX_METHODS_SIZE; i++) {
+--
+2.25.1
+
diff --git a/meta-oe/recipes-support/libssh/libssh_0.8.9.bb b/meta-oe/recipes-support/libssh/libssh_0.8.9.bb
index c7e9c3320c..98910d3068 100644
--- a/meta-oe/recipes-support/libssh/libssh_0.8.9.bb
+++ b/meta-oe/recipes-support/libssh/libssh_0.8.9.bb
@@ -6,7 +6,19 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=dabb4958b830e5df11d2b0ed8ea255a0"
DEPENDS = "zlib openssl"
-SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable-0.8"
+SRC_URI = "git://git.libssh.org/projects/libssh.git;protocol=https;branch=stable-0.8 \
+ file://CVE-2020-16135.patch \
+ file://CVE-2023-48795-1.patch \
+ file://CVE-2023-48795-2.patch \
+ file://CVE-2023-48795-3.patch \
+ file://0001-config-Move-common-parser-functions-to-config_parser.patch \
+ file://001_CVE-2023-6004.patch \
+ file://002_CVE-2023-6004.patch \
+ file://003_CVE-2023-6004.patch \
+ file://004_CVE-2023-6004.patch \
+ file://005_CVE-2023-6004.patch \
+ file://006_CVE-2023-6004.patch \
+ "
SRCREV = "04685a74df9ce1db1bc116a83a0da78b4f4fa1f8"
S = "${WORKDIR}/git"
diff --git a/meta-oe/recipes-support/multipath-tools/files/CVE-2022-41974.patch b/meta-oe/recipes-support/multipath-tools/files/CVE-2022-41974.patch
new file mode 100644
index 0000000000..7cdb5f9bda
--- /dev/null
+++ b/meta-oe/recipes-support/multipath-tools/files/CVE-2022-41974.patch
@@ -0,0 +1,164 @@
+From 0168696f95b5c610c3861ced8ef98accd1a83b91 Mon Sep 17 00:00:00 2001
+From: Benjamin Marzinski <bmarzins@redhat.com>
+Date: Tue, 27 Sep 2022 12:36:37 +0200
+Subject: [PATCH] multipathd: ignore duplicated multipathd command keys
+
+multipath adds rather than or-s the values of command keys. Fix this.
+Also, return an invalid fingerprint if a key is used more than once.
+
+CVE: CVE-2022-41974
+
+References:
+https://nvd.nist.gov/vuln/detail/CVE-2022-41974
+https://github.com/opensvc/multipath-tools/issues/59
+
+Upstream-Status: Backport
+[https://github.com/openSUSE/multipath-tools/commit/fbbf280a0e26026c19879d938ebb2a8200b6357c]
+
+Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ multipathd/cli.c | 8 ++--
+ multipathd/main.c | 104 +++++++++++++++++++++++-----------------------
+ 2 files changed, 57 insertions(+), 55 deletions(-)
+
+diff --git a/multipathd/cli.c b/multipathd/cli.c
+index 800c0fbe..0a266761 100644
+--- a/multipathd/cli.c
++++ b/multipathd/cli.c
+@@ -336,9 +336,11 @@ fingerprint(vector vec)
+ if (!vec)
+ return 0;
+
+- vector_foreach_slot(vec, kw, i)
+- fp += kw->code;
+-
++ vector_foreach_slot(vec, kw, i) {
++ if (fp & kw->code)
++ return (uint64_t)-1;
++ fp |= kw->code;
++ }
+ return fp;
+ }
+
+diff --git a/multipathd/main.c b/multipathd/main.c
+index 8baf9abe..975287d2 100644
+--- a/multipathd/main.c
++++ b/multipathd/main.c
+@@ -1522,61 +1522,61 @@ uxlsnrloop (void * ap)
+ /* Tell main thread that thread has started */
+ post_config_state(DAEMON_CONFIGURE);
+
+- set_handler_callback(LIST+PATHS, cli_list_paths);
+- set_handler_callback(LIST+PATHS+FMT, cli_list_paths_fmt);
+- set_handler_callback(LIST+PATHS+RAW+FMT, cli_list_paths_raw);
+- set_handler_callback(LIST+PATH, cli_list_path);
+- set_handler_callback(LIST+MAPS, cli_list_maps);
+- set_handler_callback(LIST+STATUS, cli_list_status);
+- set_unlocked_handler_callback(LIST+DAEMON, cli_list_daemon);
+- set_handler_callback(LIST+MAPS+STATUS, cli_list_maps_status);
+- set_handler_callback(LIST+MAPS+STATS, cli_list_maps_stats);
+- set_handler_callback(LIST+MAPS+FMT, cli_list_maps_fmt);
+- set_handler_callback(LIST+MAPS+RAW+FMT, cli_list_maps_raw);
+- set_handler_callback(LIST+MAPS+TOPOLOGY, cli_list_maps_topology);
+- set_handler_callback(LIST+TOPOLOGY, cli_list_maps_topology);
+- set_handler_callback(LIST+MAPS+JSON, cli_list_maps_json);
+- set_handler_callback(LIST+MAP+TOPOLOGY, cli_list_map_topology);
+- set_handler_callback(LIST+MAP+FMT, cli_list_map_fmt);
+- set_handler_callback(LIST+MAP+RAW+FMT, cli_list_map_fmt);
+- set_handler_callback(LIST+MAP+JSON, cli_list_map_json);
+- set_handler_callback(LIST+CONFIG+LOCAL, cli_list_config_local);
+- set_handler_callback(LIST+CONFIG, cli_list_config);
+- set_handler_callback(LIST+BLACKLIST, cli_list_blacklist);
+- set_handler_callback(LIST+DEVICES, cli_list_devices);
+- set_handler_callback(LIST+WILDCARDS, cli_list_wildcards);
+- set_handler_callback(RESET+MAPS+STATS, cli_reset_maps_stats);
+- set_handler_callback(RESET+MAP+STATS, cli_reset_map_stats);
+- set_handler_callback(ADD+PATH, cli_add_path);
+- set_handler_callback(DEL+PATH, cli_del_path);
+- set_handler_callback(ADD+MAP, cli_add_map);
+- set_handler_callback(DEL+MAP, cli_del_map);
+- set_handler_callback(SWITCH+MAP+GROUP, cli_switch_group);
++ set_handler_callback(LIST|PATHS, cli_list_paths);
++ set_handler_callback(LIST|PATHS|FMT, cli_list_paths_fmt);
++ set_handler_callback(LIST|PATHS|RAW|FMT, cli_list_paths_raw);
++ set_handler_callback(LIST|PATH, cli_list_path);
++ set_handler_callback(LIST|MAPS, cli_list_maps);
++ set_handler_callback(LIST|STATUS, cli_list_status);
++ set_unlocked_handler_callback(LIST|DAEMON, cli_list_daemon);
++ set_handler_callback(LIST|MAPS|STATUS, cli_list_maps_status);
++ set_handler_callback(LIST|MAPS|STATS, cli_list_maps_stats);
++ set_handler_callback(LIST|MAPS|FMT, cli_list_maps_fmt);
++ set_handler_callback(LIST|MAPS|RAW|FMT, cli_list_maps_raw);
++ set_handler_callback(LIST|MAPS|TOPOLOGY, cli_list_maps_topology);
++ set_handler_callback(LIST|TOPOLOGY, cli_list_maps_topology);
++ set_handler_callback(LIST|MAPS|JSON, cli_list_maps_json);
++ set_handler_callback(LIST|MAP|TOPOLOGY, cli_list_map_topology);
++ set_handler_callback(LIST|MAP|FMT, cli_list_map_fmt);
++ set_handler_callback(LIST|MAP|RAW|FMT, cli_list_map_fmt);
++ set_handler_callback(LIST|MAP|JSON, cli_list_map_json);
++ set_handler_callback(LIST|CONFIG|LOCAL, cli_list_config_local);
++ set_handler_callback(LIST|CONFIG, cli_list_config);
++ set_handler_callback(LIST|BLACKLIST, cli_list_blacklist);
++ set_handler_callback(LIST|DEVICES, cli_list_devices);
++ set_handler_callback(LIST|WILDCARDS, cli_list_wildcards);
++ set_handler_callback(RESET|MAPS|STATS, cli_reset_maps_stats);
++ set_handler_callback(RESET|MAP|STATS, cli_reset_map_stats);
++ set_handler_callback(ADD|PATH, cli_add_path);
++ set_handler_callback(DEL|PATH, cli_del_path);
++ set_handler_callback(ADD|MAP, cli_add_map);
++ set_handler_callback(DEL|MAP, cli_del_map);
++ set_handler_callback(SWITCH|MAP|GROUP, cli_switch_group);
+ set_unlocked_handler_callback(RECONFIGURE, cli_reconfigure);
+- set_handler_callback(SUSPEND+MAP, cli_suspend);
+- set_handler_callback(RESUME+MAP, cli_resume);
+- set_handler_callback(RESIZE+MAP, cli_resize);
+- set_handler_callback(RELOAD+MAP, cli_reload);
+- set_handler_callback(RESET+MAP, cli_reassign);
+- set_handler_callback(REINSTATE+PATH, cli_reinstate);
+- set_handler_callback(FAIL+PATH, cli_fail);
+- set_handler_callback(DISABLEQ+MAP, cli_disable_queueing);
+- set_handler_callback(RESTOREQ+MAP, cli_restore_queueing);
+- set_handler_callback(DISABLEQ+MAPS, cli_disable_all_queueing);
+- set_handler_callback(RESTOREQ+MAPS, cli_restore_all_queueing);
++ set_handler_callback(SUSPEND|MAP, cli_suspend);
++ set_handler_callback(RESUME|MAP, cli_resume);
++ set_handler_callback(RESIZE|MAP, cli_resize);
++ set_handler_callback(RELOAD|MAP, cli_reload);
++ set_handler_callback(RESET|MAP, cli_reassign);
++ set_handler_callback(REINSTATE|PATH, cli_reinstate);
++ set_handler_callback(FAIL|PATH, cli_fail);
++ set_handler_callback(DISABLEQ|MAP, cli_disable_queueing);
++ set_handler_callback(RESTOREQ|MAP, cli_restore_queueing);
++ set_handler_callback(DISABLEQ|MAPS, cli_disable_all_queueing);
++ set_handler_callback(RESTOREQ|MAPS, cli_restore_all_queueing);
+ set_unlocked_handler_callback(QUIT, cli_quit);
+ set_unlocked_handler_callback(SHUTDOWN, cli_shutdown);
+- set_handler_callback(GETPRSTATUS+MAP, cli_getprstatus);
+- set_handler_callback(SETPRSTATUS+MAP, cli_setprstatus);
+- set_handler_callback(UNSETPRSTATUS+MAP, cli_unsetprstatus);
+- set_handler_callback(FORCEQ+DAEMON, cli_force_no_daemon_q);
+- set_handler_callback(RESTOREQ+DAEMON, cli_restore_no_daemon_q);
+- set_handler_callback(GETPRKEY+MAP, cli_getprkey);
+- set_handler_callback(SETPRKEY+MAP+KEY, cli_setprkey);
+- set_handler_callback(UNSETPRKEY+MAP, cli_unsetprkey);
+- set_handler_callback(SETMARGINAL+PATH, cli_set_marginal);
+- set_handler_callback(UNSETMARGINAL+PATH, cli_unset_marginal);
+- set_handler_callback(UNSETMARGINAL+MAP, cli_unset_all_marginal);
++ set_handler_callback(GETPRSTATUS|MAP, cli_getprstatus);
++ set_handler_callback(SETPRSTATUS|MAP, cli_setprstatus);
++ set_handler_callback(UNSETPRSTATUS|MAP, cli_unsetprstatus);
++ set_handler_callback(FORCEQ|DAEMON, cli_force_no_daemon_q);
++ set_handler_callback(RESTOREQ|DAEMON, cli_restore_no_daemon_q);
++ set_handler_callback(GETPRKEY|MAP, cli_getprkey);
++ set_handler_callback(SETPRKEY|MAP|KEY, cli_setprkey);
++ set_handler_callback(UNSETPRKEY|MAP, cli_unsetprkey);
++ set_handler_callback(SETMARGINAL|PATH, cli_set_marginal);
++ set_handler_callback(UNSETMARGINAL|PATH, cli_unset_marginal);
++ set_handler_callback(UNSETMARGINAL|MAP, cli_unset_all_marginal);
+
+ umask(077);
+ uxsock_listen(&uxsock_trigger, ux_sock, ap);
+--
+2.31.1
diff --git a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.8.4.bb b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.8.4.bb
index 2e929362d4..0d51263f66 100644
--- a/meta-oe/recipes-support/multipath-tools/multipath-tools_0.8.4.bb
+++ b/meta-oe/recipes-support/multipath-tools/multipath-tools_0.8.4.bb
@@ -49,6 +49,7 @@ SRC_URI = "git://github.com/opensvc/multipath-tools.git;protocol=http;branch=mas
file://0001-fix-boolean-value-with-json-c-0.14.patch \
file://0001-libmultipath-uevent.c-fix-error-handling-for-udev_mo.patch \
file://0001-multipath-tools-use-run-instead-of-dev-shm.patch \
+ file://CVE-2022-41974.patch \
"
LIC_FILES_CHKSUM = "file://COPYING;md5=5f30f0716dfdd0d91eb439ebec522ec2"
@@ -122,5 +123,5 @@ FILES:kpartx = "${base_sbindir}/kpartx \
RDEPENDS:${PN} += "kpartx"
PARALLEL_MAKE = ""
-FILES:${PN}-libs += "usr/lib"
+FILES:${PN}-libs += "usr/lib/*.so.*"
FILES:${PN}-libs += "usr/lib/tmpfiles.d/*"
diff --git a/meta-oe/recipes-support/nss/nss/0001-Bug-1780432-CVE-2023-5388-Timing-attack-against-RSA-.patch b/meta-oe/recipes-support/nss/nss/0001-Bug-1780432-CVE-2023-5388-Timing-attack-against-RSA-.patch
new file mode 100644
index 0000000000..d7c5aae50a
--- /dev/null
+++ b/meta-oe/recipes-support/nss/nss/0001-Bug-1780432-CVE-2023-5388-Timing-attack-against-RSA-.patch
@@ -0,0 +1,681 @@
+From 765b89613b16866c3f3241605d84917e5c5baf0d Mon Sep 17 00:00:00 2001
+From: Robert Relyea <rrelyea@redhat.com>
+Date: Wed, 14 Feb 2024 18:55:02 +0000
+Subject: [PATCH] Bug 1780432 (CVE-2023-5388) Timing attack against RSA
+ decryption (in TLS) r=jschanck
+
+1. Add Constant time mult mod functions.
+ a. constant time mul
+ b. use constant time montgomery reduce.
+
+2. Use montgomery values for blinding.
+
+Differential Revision: https://phabricator.services.mozilla.com/D197807
+
+--HG--
+extra : moz-landing-system : lando
+
+CVE: CVE-2023-5388
+Upstream-Status: Backport [https://github.com/nss-dev/nss/commit/765b89613b16866c3f3241605d84917e5c5baf0d]
+
+Signed-off-by: Peter Marko <peter.marko@siemens.com>
+---
+ lib/freebl/mpi/mpi-priv.h | 3 +
+ lib/freebl/mpi/mpi.c | 300 +++++++++++++++++++++++++++++++++++---
+ lib/freebl/mpi/mpi.h | 41 ++++++
+ lib/freebl/mpi/mpmontg.c | 29 ++--
+ lib/freebl/rsa.c | 16 +-
+ 5 files changed, 358 insertions(+), 31 deletions(-)
+
+diff --git a/lib/freebl/mpi/mpi-priv.h b/lib/freebl/mpi/mpi-priv.h
+index 9447a818f..b4333fb6b 100644
+--- a/lib/freebl/mpi/mpi-priv.h
++++ b/lib/freebl/mpi/mpi-priv.h
+@@ -204,6 +204,9 @@ void MPI_ASM_DECL s_mpv_mul_d_add(const mp_digit *a, mp_size a_len,
+ void MPI_ASM_DECL s_mpv_mul_d_add_prop(const mp_digit *a,
+ mp_size a_len, mp_digit b,
+ mp_digit *c);
++void MPI_ASM_DECL s_mpv_mul_d_add_propCT(const mp_digit *a,
++ mp_size a_len, mp_digit b,
++ mp_digit *c, mp_size c_len);
+ void MPI_ASM_DECL s_mpv_sqr_add_prop(const mp_digit *a,
+ mp_size a_len,
+ mp_digit *sqrs);
+diff --git a/lib/freebl/mpi/mpi.c b/lib/freebl/mpi/mpi.c
+index 2e6cd8466..7749dc710 100644
+--- a/lib/freebl/mpi/mpi.c
++++ b/lib/freebl/mpi/mpi.c
+@@ -13,6 +13,8 @@
+ #include <c_asm.h>
+ #endif
+
++#include <assert.h>
++
+ #if defined(__arm__) && \
+ ((defined(__thumb__) && !defined(__thumb2__)) || defined(__ARM_ARCH_3__))
+ /* 16-bit thumb or ARM v3 doesn't work inlined assember version */
+@@ -805,15 +807,18 @@ CLEANUP:
+
+ /* }}} */
+
+-/* {{{ mp_mul(a, b, c) */
++/* {{{ s_mp_mulg(a, b, c) */
+
+ /*
+- mp_mul(a, b, c)
++ s_mp_mulg(a, b, c)
+
+- Compute c = a * b. All parameters may be identical.
++ Compute c = a * b. All parameters may be identical. if constantTime is set,
++ then the operations are done in constant time. The original is mostly
++ constant time as long as s_mpv_mul_d_add() is constant time. This is true
++ of the x86 assembler, as well as the current c code.
+ */
+ mp_err
+-mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
++s_mp_mulg(const mp_int *a, const mp_int *b, mp_int *c, int constantTime)
+ {
+ mp_digit *pb;
+ mp_int tmp;
+@@ -849,7 +854,14 @@ mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
+ goto CLEANUP;
+
+ #ifdef NSS_USE_COMBA
+- if ((MP_USED(a) == MP_USED(b)) && IS_POWER_OF_2(MP_USED(b))) {
++ /* comba isn't constant time because it clamps! If we cared
++ * (we needed a constant time version of multiply that was 'faster'
++ * we could easily pass constantTime down to the comba code and
++ * get it to skip the clamp... but here are assembler versions
++ * which add comba to platforms that can't compile the normal
++ * comba's imbedded assembler which would also need to change, so
++ * for now we just skip comba when we are running constant time. */
++ if (!constantTime && (MP_USED(a) == MP_USED(b)) && IS_POWER_OF_2(MP_USED(b))) {
+ if (MP_USED(a) == 4) {
+ s_mp_mul_comba_4(a, b, c);
+ goto CLEANUP;
+@@ -879,13 +891,15 @@ mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
+ mp_digit b_i = *pb++;
+
+ /* Inner product: Digits of a */
+- if (b_i)
++ if (constantTime || b_i)
+ s_mpv_mul_d_add(MP_DIGITS(a), useda, b_i, MP_DIGITS(c) + ib);
+ else
+ MP_DIGIT(c, ib + useda) = b_i;
+ }
+
+- s_mp_clamp(c);
++ if (!constantTime) {
++ s_mp_clamp(c);
++ }
+
+ if (SIGN(a) == SIGN(b) || s_mp_cmp_d(c, 0) == MP_EQ)
+ SIGN(c) = ZPOS;
+@@ -895,10 +909,54 @@ mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
+ CLEANUP:
+ mp_clear(&tmp);
+ return res;
++} /* end smp_mulg() */
++
++/* }}} */
++
++/* {{{ mp_mul(a, b, c) */
++
++/*
++ mp_mul(a, b, c)
++
++ Compute c = a * b. All parameters may be identical.
++ */
++
++mp_err
++mp_mul(const mp_int *a, const mp_int *b, mp_int *c)
++{
++ return s_mp_mulg(a, b, c, 0);
+ } /* end mp_mul() */
+
+ /* }}} */
+
++/* {{{ mp_mulCT(a, b, c) */
++
++/*
++ mp_mulCT(a, b, c)
++
++ Compute c = a * b. In constant time. Parameters may not be identical.
++ NOTE: a and b may be modified.
++ */
++
++mp_err
++mp_mulCT(mp_int *a, mp_int *b, mp_int *c, mp_size setSize)
++{
++ mp_err res;
++
++ /* make the multiply values fixed length so multiply
++ * doesn't leak the length. at this point all the
++ * values are blinded, but once we finish we want the
++ * output size to be hidden (so no clamping the out put) */
++ MP_CHECKOK(s_mp_pad(a, setSize));
++ MP_CHECKOK(s_mp_pad(b, setSize));
++ MP_CHECKOK(s_mp_pad(c, 2 * setSize));
++ MP_CHECKOK(s_mp_mulg(a, b, c, 1));
++CLEANUP:
++ return res;
++} /* end mp_mulCT() */
++
++/* }}} */
++
+ /* {{{ mp_sqr(a, sqr) */
+
+ #if MP_SQUARE
+@@ -1271,6 +1329,138 @@ mp_mod(const mp_int *a, const mp_int *m, mp_int *c)
+
+ /* }}} */
+
++/* {{{ s_mp_subCT_d(a, b, borrow, c) */
++
++/*
++ s_mp_subCT_d(a, b, borrow, c)
++
++ Compute c = (a -b) - subtract in constant time. returns borrow
++ */
++mp_digit
++s_mp_subCT_d(mp_digit a, mp_digit b, mp_digit borrow, mp_digit *ret)
++{
++ *ret = a - b - borrow;
++ return MP_CT_LTU(a, *ret) | (MP_CT_EQ(a, *ret) & borrow);
++} /* s_mp_subCT_d() */
++
++/* }}} */
++
++/* {{{ mp_subCT(a, b, ret, borrow) */
++
++/* return ret= a - b and borrow in borrow. done in constant time.
++ * b could be modified.
++ */
++mp_err
++mp_subCT(const mp_int *a, mp_int *b, mp_int *ret, mp_digit *borrow)
++{
++ mp_size used_a = MP_USED(a);
++ mp_size i;
++ mp_err res;
++
++ MP_CHECKOK(s_mp_pad(b, used_a));
++ MP_CHECKOK(s_mp_pad(ret, used_a));
++ *borrow = 0;
++ for (i = 0; i < used_a; i++) {
++ *borrow = s_mp_subCT_d(MP_DIGIT(a, i), MP_DIGIT(b, i), *borrow,
++ &MP_DIGIT(ret, i));
++ }
++
++ res = MP_OKAY;
++CLEANUP:
++ return res;
++} /* end mp_subCT() */
++
++/* }}} */
++
++/* {{{ mp_selectCT(cond, a, b, ret) */
++
++/*
++ * return ret= cond ? a : b; cond should be either 0 or 1
++ */
++mp_err
++mp_selectCT(mp_digit cond, const mp_int *a, const mp_int *b, mp_int *ret)
++{
++ mp_size used_a = MP_USED(a);
++ mp_err res;
++ mp_size i;
++
++ cond *= MP_DIGIT_MAX;
++
++ /* we currently require these to be equal on input,
++ * we could use pad to extend one of them, but that might
++ * leak data as it wouldn't be constant time */
++ if (used_a != MP_USED(b)) {
++ return MP_BADARG;
++ }
++
++ MP_CHECKOK(s_mp_pad(ret, used_a));
++ for (i = 0; i < used_a; i++) {
++ MP_DIGIT(ret, i) = MP_CT_SEL_DIGIT(cond, MP_DIGIT(a, i), MP_DIGIT(b, i));
++ }
++ res = MP_OKAY;
++CLEANUP:
++ return res;
++} /* end mp_selectCT() */
++
++/* {{{ mp_reduceCT(a, m, c) */
++
++/*
++ mp_reduceCT(a, m, c)
++
++ Compute c = aR^-1 (mod m) in constant time.
++ input should be in montgomery form. If input is the
++ result of a montgomery multiply then out put will be
++ in mongomery form.
++ Result will be reduced to MP_USED(m), but not be
++ clamped.
++ */
++
++mp_err
++mp_reduceCT(const mp_int *a, const mp_int *m, mp_digit n0i, mp_int *c)
++{
++ mp_size used_m = MP_USED(m);
++ mp_size used_c = used_m * 2 + 1;
++ mp_digit *m_digits, *c_digits;
++ mp_size i;
++ mp_digit borrow, carry;
++ mp_err res;
++ mp_int sub;
++
++ MP_DIGITS(&sub) = 0;
++ MP_CHECKOK(mp_init_size(&sub, used_m));
++
++ if (a != c) {
++ MP_CHECKOK(mp_copy(a, c));
++ }
++ MP_CHECKOK(s_mp_pad(c, used_c));
++ m_digits = MP_DIGITS(m);
++ c_digits = MP_DIGITS(c);
++ for (i = 0; i < used_m; i++) {
++ mp_digit m_i = MP_DIGIT(c, i) * n0i;
++ s_mpv_mul_d_add_propCT(m_digits, used_m, m_i, c_digits++, used_c--);
++ }
++ s_mp_rshd(c, used_m);
++ /* MP_USED(c) should be used_m+1 with the high word being any carry
++ * from the previous multiply, save that carry and drop the high
++ * word for the substraction below */
++ carry = MP_DIGIT(c, used_m);
++ MP_DIGIT(c, used_m) = 0;
++ MP_USED(c) = used_m;
++ /* mp_subCT wants c and m to be the same size, we've already
++ * guarrenteed that in the previous statement, so mp_subCT won't actually
++ * modify m, so it's safe to recast */
++ MP_CHECKOK(mp_subCT(c, (mp_int *)m, &sub, &borrow));
++
++ /* we return c-m if c >= m no borrow or there was a borrow and a carry */
++ MP_CHECKOK(mp_selectCT(borrow ^ carry, c, &sub, c));
++ res = MP_OKAY;
++CLEANUP:
++ mp_clear(&sub);
++ return res;
++} /* end mp_reduceCT() */
++
++/* }}} */
++
+ /* {{{ mp_mod_d(a, d, c) */
+
+ /*
+@@ -1387,6 +1577,37 @@ mp_mulmod(const mp_int *a, const mp_int *b, const mp_int *m, mp_int *c)
+
+ /* }}} */
+
++/* {{{ mp_mulmontmodCT(a, b, m, c) */
++
++/*
++ mp_mulmontmodCT(a, b, m, c)
++
++ Compute c = (a * b) mod m in constant time wrt a and b. either a or b
++ should be in montgomery form and the output is native. If both a and b
++ are in montgomery form, then the output will also be in montgomery form
++ and can be recovered with an mp_reduceCT call.
++ NOTE: a and b may be modified.
++ */
++
++mp_err
++mp_mulmontmodCT(mp_int *a, mp_int *b, const mp_int *m, mp_digit n0i,
++ mp_int *c)
++{
++ mp_err res;
++
++ ARGCHK(a != NULL && b != NULL && m != NULL && c != NULL, MP_BADARG);
++
++ if ((res = mp_mulCT(a, b, c, MP_USED(m))) != MP_OKAY)
++ return res;
++
++ if ((res = mp_reduceCT(c, m, n0i, c)) != MP_OKAY)
++ return res;
++
++ return MP_OKAY;
++}
++
++/* }}} */
++
+ /* {{{ mp_sqrmod(a, m, c) */
+
+ #if MP_SQUARE
+@@ -3946,15 +4167,63 @@ s_mp_mul(mp_int *a, const mp_int *b)
+ a1b0 = (a >> MP_HALF_DIGIT_BIT) * (b & MP_HALF_DIGIT_MAX); \
+ a1b0 += a0b1; \
+ Phi += a1b0 >> MP_HALF_DIGIT_BIT; \
+- if (a1b0 < a0b1) \
+- Phi += MP_HALF_RADIX; \
++ Phi += (MP_CT_LTU(a1b0, a0b1)) << MP_HALF_DIGIT_BIT; \
+ a1b0 <<= MP_HALF_DIGIT_BIT; \
+ Plo += a1b0; \
+- if (Plo < a1b0) \
+- ++Phi; \
++ Phi += MP_CT_LTU(Plo, a1b0); \
+ }
+ #endif
+
++/* Constant time version of s_mpv_mul_d_add_prop.
++ * Presently, this is only used by the Constant time Montgomery arithmetic code. */
++/* c += a * b */
++void
++s_mpv_mul_d_add_propCT(const mp_digit *a, mp_size a_len, mp_digit b,
++ mp_digit *c, mp_size c_len)
++{
++#if !defined(MP_NO_MP_WORD) && !defined(MP_NO_MUL_WORD)
++ mp_digit d = 0;
++
++ c_len -= a_len;
++ /* Inner product: Digits of a */
++ while (a_len--) {
++ mp_word w = ((mp_word)b * *a++) + *c + d;
++ *c++ = ACCUM(w);
++ d = CARRYOUT(w);
++ }
++
++ /* propagate the carry to the end, even if carry is zero */
++ while (c_len--) {
++ mp_word w = (mp_word)*c + d;
++ *c++ = ACCUM(w);
++ d = CARRYOUT(w);
++ }
++#else
++ mp_digit carry = 0;
++ c_len -= a_len;
++ while (a_len--) {
++ mp_digit a_i = *a++;
++ mp_digit a0b0, a1b1;
++ MP_MUL_DxD(a_i, b, a1b1, a0b0);
++
++ a0b0 += carry;
++ a1b1 += MP_CT_LTU(a0b0, carry);
++ a0b0 += a_i = *c;
++ a1b1 += MP_CT_LTU(a0b0, a_i);
++
++ *c++ = a0b0;
++ carry = a1b1;
++ }
++ /* propagate the carry to the end, even if carry is zero */
++ while (c_len--) {
++ mp_digit c_i = *c;
++ carry += c_i;
++ *c++ = carry;
++ carry = MP_CT_LTU(carry, c_i);
++ }
++#endif
++}
++
+ #if !defined(MP_ASSEMBLY_MULTIPLY)
+ /* c = a * b */
+ void
+@@ -3979,8 +4248,7 @@ s_mpv_mul_d(const mp_digit *a, mp_size a_len, mp_digit b, mp_digit *c)
+ MP_MUL_DxD(a_i, b, a1b1, a0b0);
+
+ a0b0 += carry;
+- if (a0b0 < carry)
+- ++a1b1;
++ a1b1 += MP_CT_LTU(a0b0, carry);
+ *c++ = a0b0;
+ carry = a1b1;
+ }
+@@ -4012,11 +4280,9 @@ s_mpv_mul_d_add(const mp_digit *a, mp_size a_len, mp_digit b,
+ MP_MUL_DxD(a_i, b, a1b1, a0b0);
+
+ a0b0 += carry;
+- if (a0b0 < carry)
+- ++a1b1;
++ a1b1 += MP_CT_LTU(a0b0, carry);
+ a0b0 += a_i = *c;
+- if (a0b0 < a_i)
+- ++a1b1;
++ a1b1 += MP_CT_LTU(a0b0, a_i);
+ *c++ = a0b0;
+ carry = a1b1;
+ }
+diff --git a/lib/freebl/mpi/mpi.h b/lib/freebl/mpi/mpi.h
+index 4ba9b6a4b..dd129db0d 100644
+--- a/lib/freebl/mpi/mpi.h
++++ b/lib/freebl/mpi/mpi.h
+@@ -150,6 +150,38 @@ typedef int mp_sword;
+ /* This defines the maximum I/O base (minimum is 2) */
+ #define MP_MAX_RADIX 64
+
++/* Constant Time Macros on mp_digits */
++#define MP_CT_HIGH_TO_LOW(x) ((mp_digit)((mp_digit)(x) >> (MP_DIGIT_BIT - 1)))
++#define MP_CT_TRUE ((mp_digit)1)
++#define MP_CT_FALSE ((mp_digit)0)
++
++/* basic zero and non zero tests */
++#define MP_CT_NOT_ZERO(x) (MP_CT_HIGH_TO_LOW(((x) | (((mp_digit)0) - (x)))))
++#define MP_CT_ZERO(x) (MP_CT_TRUE ^ MP_CT_HIGH_TO_LOW(((x) | (((mp_digit)0) - (x)))))
++
++/* basic constant-time helper macro for equalities and inequalities.
++ * The inequalities will produce incorrect results if
++ * abs(a-b) >= MP_DIGIT_SIZE/2. This can be avoided if unsigned values stay
++ * within the range 0-MP_DIGIT_MAX/2. */
++#define MP_CT_EQ(a, b) MP_CT_ZERO(((a) ^ (b)))
++#define MP_CT_NE(a, b) MP_CT_NOT_ZERO(((a) ^ (b)))
++#define MP_CT_GT(a, b) MP_CT_HIGH_TO_LOW((b) - (a))
++#define MP_CT_LT(a, b) MP_CT_HIGH_TO_LOW((a) - (b))
++#define MP_CT_GE(a, b) (MP_CT_TRUE ^ MP_CT_LT(a, b))
++#define MP_CT_LE(a, b) (MP_CT_TRUE ^ MP_CT_GT(a, b))
++
++/* use constant time result to select a boolean value
++ * or an mp digit depending on the args */
++#define MP_CT_SEL(m, l, r) ((r) ^ ((m) & ((r) ^ (l))))
++#define MP_CT_SELB(m, l, r) MP_CT_SEL(m, l, r) /* mask, l and r are booleans */
++#define MP_CT_SEL_DIGIT(m, l, r) MP_CT_SEL(m, l, r) /*mask, l, and r are mp_digit */
++
++/* full inequalities that work with full mp_digit values */
++#define MP_CT_OVERFLOW(a, b, c, d) \
++ MP_CT_SELB(MP_CT_HIGH_TO_LOW((a) ^ (b)), \
++ (MP_CT_HIGH_TO_LOW(d)), c)
++#define MP_CT_LTU(a, b) MP_CT_OVERFLOW(a, b, MP_CT_LT(a, b), b)
++
+ typedef struct {
+ mp_sign sign; /* sign of this quantity */
+ mp_size alloc; /* how many digits allocated */
+@@ -190,7 +222,9 @@ mp_err mp_neg(const mp_int *a, mp_int *b);
+ /* Full arithmetic */
+ mp_err mp_add(const mp_int *a, const mp_int *b, mp_int *c);
+ mp_err mp_sub(const mp_int *a, const mp_int *b, mp_int *c);
++mp_err mp_subCT(const mp_int *a, mp_int *b, mp_int *c, mp_digit *borrow);
+ mp_err mp_mul(const mp_int *a, const mp_int *b, mp_int *c);
++mp_err mp_mulCT(mp_int *a, mp_int *b, mp_int *c, mp_size setSize);
+ #if MP_SQUARE
+ mp_err mp_sqr(const mp_int *a, mp_int *b);
+ #else
+@@ -217,6 +251,12 @@ mp_err mp_exptmod(const mp_int *a, const mp_int *b, const mp_int *m, mp_int *c);
+ mp_err mp_exptmod_d(const mp_int *a, mp_digit d, const mp_int *m, mp_int *c);
+ #endif /* MP_MODARITH */
+
++/* montgomery math */
++mp_err mp_to_mont(const mp_int *x, const mp_int *N, mp_int *xMont);
++mp_digit mp_calculate_mont_n0i(const mp_int *N);
++mp_err mp_reduceCT(const mp_int *a, const mp_int *m, mp_digit n0i, mp_int *ct);
++mp_err mp_mulmontmodCT(mp_int *a, mp_int *b, const mp_int *m, mp_digit n0i, mp_int *c);
++
+ /* Comparisons */
+ int mp_cmp_z(const mp_int *a);
+ int mp_cmp_d(const mp_int *a, mp_digit d);
+@@ -224,6 +264,7 @@ int mp_cmp(const mp_int *a, const mp_int *b);
+ int mp_cmp_mag(const mp_int *a, const mp_int *b);
+ int mp_isodd(const mp_int *a);
+ int mp_iseven(const mp_int *a);
++mp_err mp_selectCT(mp_digit cond, const mp_int *a, const mp_int *b, mp_int *ret);
+
+ /* Number theoretic */
+ mp_err mp_gcd(mp_int *a, mp_int *b, mp_int *c);
+diff --git a/lib/freebl/mpi/mpmontg.c b/lib/freebl/mpi/mpmontg.c
+index 58f5cde2a..63842c631 100644
+--- a/lib/freebl/mpi/mpmontg.c
++++ b/lib/freebl/mpi/mpmontg.c
+@@ -129,20 +129,27 @@ CLEANUP:
+ }
+ #endif
+
+-STATIC
+ mp_err
+-s_mp_to_mont(const mp_int *x, mp_mont_modulus *mmm, mp_int *xMont)
++mp_to_mont(const mp_int *x, const mp_int *N, mp_int *xMont)
+ {
+ mp_err res;
+
+ /* xMont = x * R mod N where N is modulus */
+- MP_CHECKOK(mp_copy(x, xMont));
+- MP_CHECKOK(s_mp_lshd(xMont, MP_USED(&mmm->N))); /* xMont = x << b */
+- MP_CHECKOK(mp_div(xMont, &mmm->N, 0, xMont)); /* mod N */
++ if (x != xMont) {
++ MP_CHECKOK(mp_copy(x, xMont));
++ }
++ MP_CHECKOK(s_mp_lshd(xMont, MP_USED(N))); /* xMont = x << b */
++ MP_CHECKOK(mp_div(xMont, N, 0, xMont)); /* mod N */
+ CLEANUP:
+ return res;
+ }
+
++mp_digit
++mp_calculate_mont_n0i(const mp_int *N)
++{
++ return 0 - s_mp_invmod_radix(MP_DIGIT(N, 0));
++}
++
+ #ifdef MP_USING_MONT_MULF
+
+ /* the floating point multiply is already cache safe,
+@@ -198,7 +205,7 @@ mp_exptmod_f(const mp_int *montBase,
+ MP_CHECKOK(mp_init_size(&accum1, 3 * nLen + 2));
+
+ mp_set(&accum1, 1);
+- MP_CHECKOK(s_mp_to_mont(&accum1, mmm, &accum1));
++ MP_CHECKOK(mp_to_mont(&accum1, &(mmm->N), &accum1));
+ MP_CHECKOK(s_mp_pad(&accum1, nLen));
+
+ oddPowSize = 2 * nLen + 1;
+@@ -478,7 +485,7 @@ mp_exptmod_i(const mp_int *montBase,
+
+ /* set accumulator to montgomery residue of 1 */
+ mp_set(&accum1, 1);
+- MP_CHECKOK(s_mp_to_mont(&accum1, mmm, &accum1));
++ MP_CHECKOK(mp_to_mont(&accum1, &(mmm->N), &accum1));
+ pa1 = &accum1;
+ pa2 = &accum2;
+
+@@ -865,7 +872,7 @@ mp_exptmod_safe_i(const mp_int *montBase,
+ MP_CHECKOK(mp_init_size(&accum[2], 3 * nLen + 2));
+ MP_CHECKOK(mp_init_size(&accum[3], 3 * nLen + 2));
+ mp_set(&accum[0], 1);
+- MP_CHECKOK(s_mp_to_mont(&accum[0], mmm, &accum[0]));
++ MP_CHECKOK(mp_to_mont(&accum[0], &(mmm->N), &accum[0]));
+ MP_CHECKOK(mp_copy(montBase, &accum[1]));
+ SQR(montBase, &accum[2]);
+ MUL_NOWEAVE(montBase, &accum[2], &accum[3]);
+@@ -884,7 +891,7 @@ mp_exptmod_safe_i(const mp_int *montBase,
+ } else {
+ if (first_window == 0) {
+ mp_set(&accum1, 1);
+- MP_CHECKOK(s_mp_to_mont(&accum1, mmm, &accum1));
++ MP_CHECKOK(mp_to_mont(&accum1, &(mmm->N), &accum1));
+ } else {
+ /* assert first_window == 1? */
+ MP_CHECKOK(mp_copy(montBase, &accum1));
+@@ -1055,9 +1062,9 @@ mp_exptmod(const mp_int *inBase, const mp_int *exponent,
+ /* compute n0', given n0, n0' = -(n0 ** -1) mod MP_RADIX
+ ** where n0 = least significant mp_digit of N, the modulus.
+ */
+- mmm.n0prime = 0 - s_mp_invmod_radix(MP_DIGIT(modulus, 0));
++ mmm.n0prime = mp_calculate_mont_n0i(modulus);
+
+- MP_CHECKOK(s_mp_to_mont(base, &mmm, &montBase));
++ MP_CHECKOK(mp_to_mont(base, modulus, &montBase));
+
+ bits_in_exponent = mpl_significant_bits(exponent);
+ #ifdef MP_USING_CACHE_SAFE_MOD_EXP
+diff --git a/lib/freebl/rsa.c b/lib/freebl/rsa.c
+index 200f1bd55..67d65ba2b 100644
+--- a/lib/freebl/rsa.c
++++ b/lib/freebl/rsa.c
+@@ -64,6 +64,8 @@ struct RSABlindingParamsStr {
+ SECItem modulus; /* list element "key" */
+ blindingParams *free, *bp; /* Blinding parameters queue */
+ blindingParams array[RSA_BLINDING_PARAMS_MAX_CACHE_SIZE];
++ /* precalculate montegomery reduction value */
++ mp_digit n0i; /* n0i = -( n & MP_DIGIT) ** -1 mod mp_RADIX */
+ };
+ typedef struct RSABlindingParamsStr RSABlindingParams;
+
+@@ -1146,6 +1148,8 @@ generate_blinding_params(RSAPrivateKey *key, mp_int *f, mp_int *g, mp_int *n,
+ CHECK_MPI_OK(mp_exptmod(&k, &e, n, f));
+ /* g = k**-1 mod n */
+ CHECK_MPI_OK(mp_invmod(&k, n, g));
++ /* g in montgomery form.. */
++ CHECK_MPI_OK(mp_to_mont(g, n, g));
+ cleanup:
+ if (kb)
+ PORT_ZFree(kb, modLen);
+@@ -1182,13 +1186,16 @@ init_blinding_params(RSABlindingParams *rsabp, RSAPrivateKey *key,
+ rsabp->bp = NULL;
+ rsabp->free = bp;
+
++ /* precalculate montgomery reduction parameter */
++ rsabp->n0i = mp_calculate_mont_n0i(n);
++
+ /* List elements are keyed using the modulus */
+ return SECITEM_CopyItem(NULL, &rsabp->modulus, &key->modulus);
+ }
+
+ static SECStatus
+ get_blinding_params(RSAPrivateKey *key, mp_int *n, unsigned int modLen,
+- mp_int *f, mp_int *g)
++ mp_int *f, mp_int *g, mp_digit *n0i)
+ {
+ RSABlindingParams *rsabp = NULL;
+ blindingParams *bpUnlinked = NULL;
+@@ -1248,6 +1255,7 @@ get_blinding_params(RSAPrivateKey *key, mp_int *n, unsigned int modLen,
+ /* We've found (or created) the RSAblindingParams struct for this key.
+ * Now, search its list of ready blinding params for a usable one.
+ */
++ *n0i = rsabp->n0i;
+ while (0 != (bp = rsabp->bp)) {
+ #ifndef UNSAFE_FUZZER_MODE
+ if (--(bp->counter) > 0)
+@@ -1355,6 +1363,7 @@ cleanup:
+ if (err) {
+ MP_TO_SEC_ERROR(err);
+ }
++ *n0i = 0;
+ return SECFailure;
+ }
+
+@@ -1374,6 +1383,7 @@ rsa_PrivateKeyOp(RSAPrivateKey *key,
+ mp_err err;
+ mp_int n, c, m;
+ mp_int f, g;
++ mp_digit n0i;
+ if (!key || !output || !input) {
+ PORT_SetError(SEC_ERROR_INVALID_ARGS);
+ return SECFailure;
+@@ -1401,7 +1411,7 @@ rsa_PrivateKeyOp(RSAPrivateKey *key,
+ ** blinding factor
+ */
+ if (nssRSAUseBlinding) {
+- CHECK_SEC_OK(get_blinding_params(key, &n, modLen, &f, &g));
++ CHECK_SEC_OK(get_blinding_params(key, &n, modLen, &f, &g, &n0i));
+ /* c' = c*f mod n */
+ CHECK_MPI_OK(mp_mulmod(&c, &f, &n, &c));
+ }
+@@ -1422,7 +1432,7 @@ rsa_PrivateKeyOp(RSAPrivateKey *key,
+ */
+ if (nssRSAUseBlinding) {
+ /* m = m'*g mod n */
+- CHECK_MPI_OK(mp_mulmod(&m, &g, &n, &m));
++ CHECK_MPI_OK(mp_mulmontmodCT(&m, &g, &n, n0i, &m));
+ }
+ err = mp_to_fixlen_octets(&m, output, modLen);
+ if (err >= 0)
+--
+2.30.2
+
diff --git a/meta-oe/recipes-support/nss/nss/0001-Bug-1867408-add-a-defensive-check-for-large-ssl_DefS.patch b/meta-oe/recipes-support/nss/nss/0001-Bug-1867408-add-a-defensive-check-for-large-ssl_DefS.patch
new file mode 100644
index 0000000000..af32c42aec
--- /dev/null
+++ b/meta-oe/recipes-support/nss/nss/0001-Bug-1867408-add-a-defensive-check-for-large-ssl_DefS.patch
@@ -0,0 +1,40 @@
+From 2e75513a13e3cf4a16626ef654242b3b07cc8f29 Mon Sep 17 00:00:00 2001
+From: John Schanck <jschanck@mozilla.com>
+Date: Mon, 11 Dec 2023 19:24:14 +0000
+Subject: [PATCH] Bug 1867408 - add a defensive check for large ssl_DefSend
+ return values. r=nkulatova
+
+Differential Revision: https://phabricator.services.mozilla.com/D195054
+
+--HG--
+extra : moz-landing-system : lando
+
+CVE: CVE-2024-0743
+Upstream-Status: Backport [https://github.com/nss-dev/nss/commit/2e75513a13e3cf4a16626ef654242b3b07cc8f29]
+
+Signed-off-by: Peter Marko <peter.marko@siemens.com>
+---
+ lib/ssl/sslsecur.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/lib/ssl/sslsecur.c b/lib/ssl/sslsecur.c
+index 59ef064c9..9e994f4b5 100644
+--- a/lib/ssl/sslsecur.c
++++ b/lib/ssl/sslsecur.c
+@@ -453,7 +453,12 @@ ssl_SendSavedWriteData(sslSocket *ss)
+ if (rv < 0) {
+ return rv;
+ }
+- ss->pendingBuf.len -= rv;
++ if (rv > ss->pendingBuf.len) {
++ PORT_Assert(0); /* This shouldn't happen */
++ ss->pendingBuf.len = 0;
++ } else {
++ ss->pendingBuf.len -= rv;
++ }
+ if (ss->pendingBuf.len > 0 && rv > 0) {
+ /* UGH !! This shifts the whole buffer down by copying it */
+ PORT_Memmove(ss->pendingBuf.buf, ss->pendingBuf.buf + rv,
+--
+2.30.2
+
diff --git a/meta-oe/recipes-support/nss/nss/0001-nss-fix-support-cross-compiling.patch b/meta-oe/recipes-support/nss/nss/0001-nss-fix-support-cross-compiling.patch
index eb6174a7b0..950fae667a 100644
--- a/meta-oe/recipes-support/nss/nss/0001-nss-fix-support-cross-compiling.patch
+++ b/meta-oe/recipes-support/nss/nss/0001-nss-fix-support-cross-compiling.patch
@@ -18,7 +18,12 @@ diff --git a/nss/coreconf/arch.mk b/nss/coreconf/arch.mk
index 2012d18..78fca62 100644
--- a/nss/coreconf/arch.mk
+++ b/nss/coreconf/arch.mk
-@@ -30,7 +30,7 @@ OS_TEST := $(shell uname -m)
+@@ -26,11 +26,11 @@ OS_ARCH := $(subst /,_,$(shell uname -s)
+ # Attempt to differentiate between sparc and x86 Solaris
+ #
+
+-OS_TEST := $(shell uname -m)
++OS_TEST ?= $(shell uname -m)
ifeq ($(OS_TEST),i86pc)
OS_RELEASE := $(shell uname -r)_$(OS_TEST)
else
diff --git a/meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch b/meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch
new file mode 100644
index 0000000000..0e0725b5f5
--- /dev/null
+++ b/meta-oe/recipes-support/nss/nss/CVE-2023-0767.patch
@@ -0,0 +1,102 @@
+# HG changeset patch
+# User John M. Schanck <jschanck@mozilla.com>
+# Date 1675974326 0
+# Node ID 684586ec163ad4fbbf15ea2cd1ee5c2da43036ad
+# Parent 58d7a8a55aea6a363bb8c7a9a7752739c4d32823
+Bug 1804640 - improve handling of unknown PKCS#12 safe bag types. r=rrelyea
+
+Differential Revision: https://phabricator.services.mozilla.com/D167443
+
+Upstream-Status: Backport [https://hg.mozilla.org/projects/nss/rev/684586ec163ad4fbbf15ea2cd1ee5c2da43036ad]
+CVE: CVE-2023-0767
+Signed-off-by: Vivek Kumbhar <vkumbhar@mvista.com>
+---
+ nss/lib/pkcs12/p12d.c | 23 +++++++++++++++--------
+ nss/lib/pkcs12/p12t.h | 1 +
+ nss/lib/pkcs12/p12tmpl.c | 4 ++--
+ 3 files changed, 18 insertions(+), 10 deletions(-)
+
+diff --git a/nss/lib/pkcs12/p12d.c b/nss/lib/pkcs12/p12d.c
+index 676f33b..decddc5 100644
+--- a/nss/lib/pkcs12/p12d.c
++++ b/nss/lib/pkcs12/p12d.c
+@@ -337,31 +337,38 @@ sec_pkcs12_decoder_safe_bag_update(void *arg, const char *data,
+ SEC_PKCS12DecoderContext *p12dcx;
+ SECStatus rv;
+
+- /* make sure that we are not skipping the current safeBag,
+- * and that there are no errors. If so, just return rather
+- * than continuing to process.
+- */
+- if (!safeContentsCtx || !safeContentsCtx->p12dcx ||
+- safeContentsCtx->p12dcx->error || safeContentsCtx->skipCurrentSafeBag) {
++ if (!safeContentsCtx || !safeContentsCtx->p12dcx || !safeContentsCtx->currentSafeBagA1Dcx) {
+ return;
+ }
+ p12dcx = safeContentsCtx->p12dcx;
+
++ /* make sure that there are no errors and we are not skipping the current safeBag */
++ if (p12dcx->error || safeContentsCtx->skipCurrentSafeBag) {
++ goto loser;
++ }
++
+ rv = SEC_ASN1DecoderUpdate(safeContentsCtx->currentSafeBagA1Dcx, data, len);
+ if (rv != SECSuccess) {
+ p12dcx->errorValue = PORT_GetError();
++ p12dcx->error = PR_TRUE;
++ goto loser;
++ }
++
++ /* The update may have set safeContentsCtx->skipCurrentSafeBag, and we
++ * may not get another opportunity to clean up the decoder context.
++ */
++ if (safeContentsCtx->skipCurrentSafeBag) {
+ goto loser;
+ }
+
+ return;
+
+ loser:
+- /* set the error, and finish the decoder context. because there
++ /* Finish the decoder context. Because there
+ * is not a way of returning an error message, it may be worth
+ * while to do a check higher up and finish any decoding contexts
+ * that are still open.
+ */
+- p12dcx->error = PR_TRUE;
+ SEC_ASN1DecoderFinish(safeContentsCtx->currentSafeBagA1Dcx);
+ safeContentsCtx->currentSafeBagA1Dcx = NULL;
+ return;
+diff --git a/nss/lib/pkcs12/p12t.h b/nss/lib/pkcs12/p12t.h
+index b22f0dd..d449afd 100644
+--- a/nss/lib/pkcs12/p12t.h
++++ b/nss/lib/pkcs12/p12t.h
+@@ -73,6 +73,7 @@ struct sec_PKCS12SafeBagStr {
+ sec_PKCS12CRLBag *crlBag;
+ sec_PKCS12SecretBag *secretBag;
+ sec_PKCS12SafeContents *safeContents;
++ SECItem *unknownBag;
+ } safeBagContent;
+
+ sec_PKCS12Attribute **attribs;
+diff --git a/nss/lib/pkcs12/p12tmpl.c b/nss/lib/pkcs12/p12tmpl.c
+index 7437cbc..b08384f 100644
+--- a/nss/lib/pkcs12/p12tmpl.c
++++ b/nss/lib/pkcs12/p12tmpl.c
+@@ -30,12 +30,12 @@ sec_pkcs12_choose_safe_bag_type(void *src_or_dest, PRBool encoding)
+
+ oiddata = SECOID_FindOID(&safeBag->safeBagType);
+ if (oiddata == NULL) {
+- return SEC_ASN1_GET(SEC_AnyTemplate);
++ return SEC_ASN1_GET(SEC_PointerToAnyTemplate);
+ }
+
+ switch (oiddata->offset) {
+ default:
+- theTemplate = SEC_ASN1_GET(SEC_AnyTemplate);
++ theTemplate = SEC_ASN1_GET(SEC_PointerToAnyTemplate);
+ break;
+ case SEC_OID_PKCS12_V1_KEY_BAG_ID:
+ theTemplate = SEC_ASN1_GET(SECKEY_PointerToPrivateKeyInfoTemplate);
+--
+2.34.1
diff --git a/meta-oe/recipes-support/nss/nss_3.74.bb b/meta-oe/recipes-support/nss/nss_3.74.bb
index 333bbdfef0..ce4137a67f 100644
--- a/meta-oe/recipes-support/nss/nss_3.74.bb
+++ b/meta-oe/recipes-support/nss/nss_3.74.bb
@@ -32,6 +32,9 @@ SRC_URI = "http://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/${VERSIO
file://system-pkcs11.txt \
file://nss-fix-nsinstall-build.patch \
file://0001-freebl-add-a-configure-option-to-disable-ARM-HW-cryp.patch \
+ file://0001-Bug-1780432-CVE-2023-5388-Timing-attack-against-RSA-.patch;patchdir=nss \
+ file://0001-Bug-1867408-add-a-defensive-check-for-large-ssl_DefS.patch;patchdir=nss \
+ file://CVE-2023-0767.patch \
"
SRC_URI[sha256sum] = "88928811f9f40f87d42e2eaccdf6e454562e51486067f2ddbe90aa47ea6cd056"
diff --git a/meta-oe/recipes-support/opencv/opencv/CVE-2023-2617.patch b/meta-oe/recipes-support/opencv/opencv/CVE-2023-2617.patch
new file mode 100644
index 0000000000..e5eafd4790
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv/CVE-2023-2617.patch
@@ -0,0 +1,88 @@
+commit ccc277247ac1a7aef0a90353edcdec35fbc5903c
+Author: Nano <nanoapezlk@gmail.com>
+Date: Wed Apr 26 15:09:52 2023 +0800
+
+ fix(wechat_qrcode): Init nBytes after the count value is determined (#3480)
+
+ * fix(wechat_qrcode): Initialize nBytes after the count value is determined
+
+ * fix(wechat_qrcode): Incorrect count data repair
+
+ * chore: format expr
+
+ * fix(wechat_qrcode): Avoid null pointer exception
+
+ * fix(wechat_qrcode): return when bytes_ is empty
+
+ * test(wechat_qrcode): add test case
+
+ ---------
+
+ Co-authored-by: GZTime <Time.GZ@outlook.com>
+
+CVE: CVE-2023-2617
+
+Upstream-Status: Backport [https://github.com/opencv/opencv_contrib/commit/ccc277247ac1a7aef0a90353edcdec35fbc5903c]
+
+Signed-off-by: Soumya <soumya.sambu@windriver.com>
+---
+
+diff --git a/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp b/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
+index 05de793c..b3a0a69c 100644
+--- a/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
++++ b/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
+@@ -65,7 +65,8 @@ void DecodedBitStreamParser::append(std::string& result, string const& in,
+
+ void DecodedBitStreamParser::append(std::string& result, const char* bufIn, size_t nIn,
+ ErrorHandler& err_handler) {
+- if (err_handler.ErrCode()) return;
++ // avoid null pointer exception
++ if (err_handler.ErrCode() || bufIn == nullptr) return;
+ #ifndef NO_ICONV_INSIDE
+ if (nIn == 0) {
+ return;
+@@ -190,16 +191,20 @@ void DecodedBitStreamParser::decodeByteSegment(Ref<BitSource> bits_, string& res
+ CharacterSetECI* currentCharacterSetECI,
+ ArrayRef<ArrayRef<char> >& byteSegments,
+ ErrorHandler& err_handler) {
+- int nBytes = count;
+ BitSource& bits(*bits_);
+ // Don't crash trying to read more bits than we have available.
+ int available = bits.available();
+ // try to repair count data if count data is invalid
+ if (count * 8 > available) {
+- count = (available + 7 / 8);
++ count = (available + 7) / 8;
+ }
++ size_t nBytes = count;
++
++ ArrayRef<char> bytes_(nBytes);
++ // issue https://github.com/opencv/opencv_contrib/issues/3478
++ if (bytes_->empty())
++ return;
+
+- ArrayRef<char> bytes_(count);
+ char* readBytes = &(*bytes_)[0];
+ for (int i = 0; i < count; i++) {
+ // readBytes[i] = (char) bits.readBits(8);
+diff --git a/modules/wechat_qrcode/test/test_qrcode.cpp b/modules/wechat_qrcode/test/test_qrcode.cpp
+index d59932b8..ec2559b0 100644
+--- a/modules/wechat_qrcode/test/test_qrcode.cpp
++++ b/modules/wechat_qrcode/test/test_qrcode.cpp
+@@ -289,5 +289,16 @@ TEST_P(Objdetect_QRCode_Multi, regression) {
+ INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Curved, testing::ValuesIn(qrcode_images_curved));
+ // INSTANTIATE_TEST_CASE_P(/**/, Objdetect_QRCode_Multi, testing::ValuesIn(qrcode_images_multiple));
+
++TEST(Objdetect_QRCode_bug, issue_3478) {
++ auto detector = wechat_qrcode::WeChatQRCode();
++ std::string image_path = findDataFile("qrcode/issue_3478.png");
++ Mat src = imread(image_path, IMREAD_GRAYSCALE);
++ ASSERT_FALSE(src.empty()) << "Can't read image: " << image_path;
++ std::vector<std::string> outs = detector.detectAndDecode(src);
++ ASSERT_EQ(1, (int) outs.size());
++ ASSERT_EQ(16, (int) outs[0].size());
++ ASSERT_EQ("KFCVW50 ", outs[0]);
++}
++
+ } // namespace
+ } // namespace opencv_test
diff --git a/meta-oe/recipes-support/opencv/opencv/CVE-2023-2618.patch b/meta-oe/recipes-support/opencv/opencv/CVE-2023-2618.patch
new file mode 100644
index 0000000000..4cd3003e3c
--- /dev/null
+++ b/meta-oe/recipes-support/opencv/opencv/CVE-2023-2618.patch
@@ -0,0 +1,32 @@
+From 2b62ff6181163eea029ed1cab11363b4996e9cd6 Mon Sep 17 00:00:00 2001
+From: Nano <nanoapezlk@gmail.com>
+Date: Thu, 27 Apr 2023 17:38:35 +0800
+Subject: [PATCH] fix(wechat_qrcode): fixed memory leaks
+
+CVE: CVE-2023-2618
+
+Upstream-Status: Backport [https://github.com/opencv/opencv_contrib/pull/3484/commits/2b62ff6181163eea029ed1cab11363b4996e9cd6]
+
+Signed-off-by: Narpat Mali <narpat.mali@windriver.com>
+---
+ .../src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp b/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
+index b3a0a69c..f02435d5 100644
+--- a/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
++++ b/modules/wechat_qrcode/src/zxing/qrcode/decoder/decoded_bit_stream_parser.cpp
+@@ -127,7 +127,10 @@ void DecodedBitStreamParser::decodeHanziSegment(Ref<BitSource> bits_, string& re
+ while (count > 0) {
+ // Each 13 bits encodes a 2-byte character
+ int twoBytes = bits.readBits(13, err_handler);
+- if (err_handler.ErrCode()) return;
++ if (err_handler.ErrCode()) {
++ delete[] buffer;
++ return;
++ }
+ int assembledTwoBytes = ((twoBytes / 0x060) << 8) | (twoBytes % 0x060);
+ if (assembledTwoBytes < 0x003BF) {
+ // In the 0xA1A1 to 0xAAFE range
+--
+2.40.0
diff --git a/meta-oe/recipes-support/opencv/opencv_4.5.5.bb b/meta-oe/recipes-support/opencv/opencv_4.5.5.bb
index e4fb676f7e..5b5685f990 100644
--- a/meta-oe/recipes-support/opencv/opencv_4.5.5.bb
+++ b/meta-oe/recipes-support/opencv/opencv_4.5.5.bb
@@ -39,12 +39,12 @@ IPP_MD5 = "${@ipp_md5sum(d)}"
SRCREV_FORMAT = "opencv_contrib_ipp_boostdesc_vgg"
SRC_URI = "git://github.com/opencv/opencv.git;name=opencv;branch=master;protocol=https \
- git://github.com/opencv/opencv_contrib.git;destsuffix=contrib;name=contrib;branch=master;protocol=https \
- git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20191018;destsuffix=ipp;name=ipp;protocol=https \
- git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=boostdesc;name=boostdesc;protocol=https \
- git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=vgg;name=vgg;protocol=https \
- git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=face;name=face;protocol=https \
- git://github.com/WeChatCV/opencv_3rdparty.git;branch=wechat_qrcode;destsuffix=wechat_qrcode;name=wechat-qrcode;protocol=https \
+ git://github.com/opencv/opencv_contrib.git;destsuffix=git/contrib;name=contrib;branch=master;protocol=https \
+ git://github.com/opencv/opencv_3rdparty.git;branch=ippicv/master_20191018;destsuffix=git/ipp;name=ipp;protocol=https \
+ git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_boostdesc_20161012;destsuffix=git/boostdesc;name=boostdesc;protocol=https \
+ git://github.com/opencv/opencv_3rdparty.git;branch=contrib_xfeatures2d_vgg_20160317;destsuffix=git/vgg;name=vgg;protocol=https \
+ git://github.com/opencv/opencv_3rdparty.git;branch=contrib_face_alignment_20170818;destsuffix=git/face;name=face;protocol=https \
+ git://github.com/WeChatCV/opencv_3rdparty.git;branch=wechat_qrcode;destsuffix=git/wechat_qrcode;name=wechat-qrcode;protocol=https \
file://0001-3rdparty-ippicv-Use-pre-downloaded-ipp.patch \
file://0003-To-fix-errors-as-following.patch \
file://0001-Temporarliy-work-around-deprecated-ffmpeg-RAW-functi.patch \
@@ -52,8 +52,10 @@ SRC_URI = "git://github.com/opencv/opencv.git;name=opencv;branch=master;protocol
file://download.patch \
file://0001-Make-ts-module-external.patch \
file://0001-core-vsx-update-vec_absd-workaround-condition.patch \
+ file://CVE-2023-2617.patch;patchdir=contrib \
+ file://CVE-2023-2618.patch;patchdir=contrib \
"
-SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=../contrib"
+SRC_URI:append:riscv64 = " file://0001-Use-Os-to-compile-tinyxml2.cpp.patch;patchdir=contrib"
S = "${WORKDIR}/git"
@@ -62,7 +64,7 @@ S = "${WORKDIR}/git"
OPENCV_DLDIR = "${WORKDIR}/downloads"
do_unpack_extra() {
- tar xzf ${WORKDIR}/ipp/ippicv/${IPP_FILENAME} -C ${WORKDIR}
+ tar xzf ${S}/ipp/ippicv/${IPP_FILENAME} -C ${S}
md5() {
# Return the MD5 of $1
@@ -77,22 +79,22 @@ do_unpack_extra() {
test -e $DEST || ln -s $F $DEST
done
}
- cache xfeatures2d/boostdesc ${WORKDIR}/boostdesc/*.i
- cache xfeatures2d/vgg ${WORKDIR}/vgg/*.i
- cache data ${WORKDIR}/face/*.dat
- cache wechat_qrcode ${WORKDIR}/wechat_qrcode/*.caffemodel
- cache wechat_qrcode ${WORKDIR}/wechat_qrcode/*.prototxt
+ cache xfeatures2d/boostdesc ${S}/boostdesc/*.i
+ cache xfeatures2d/vgg ${S}/vgg/*.i
+ cache data ${S}/face/*.dat
+ cache wechat_qrcode ${S}/wechat_qrcode/*.caffemodel
+ cache wechat_qrcode ${S}/wechat_qrcode/*.prototxt
}
addtask unpack_extra after do_unpack before do_patch
CMAKE_VERBOSE = "VERBOSE=1"
-EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${WORKDIR}/contrib/modules \
+EXTRA_OECMAKE = "-DOPENCV_EXTRA_MODULES_PATH=${S}/contrib/modules \
-DWITH_1394=OFF \
-DENABLE_PRECOMPILED_HEADERS=OFF \
-DCMAKE_SKIP_RPATH=ON \
-DOPENCV_ICV_HASH=${IPP_MD5} \
- -DIPPROOT=${WORKDIR}/ippicv_lnx \
+ -DIPPROOT=${S}/ippicv_lnx \
-DOPENCV_GENERATE_PKGCONFIG=ON \
-DOPENCV_DOWNLOAD_PATH=${OPENCV_DLDIR} \
-DOPENCV_ALLOW_DOWNLOADS=OFF \
diff --git a/meta-oe/recipes-support/openldap/openldap/0001-ITS-10094-libldap-OpenSSL-fix-setting-ciphersuites.patch b/meta-oe/recipes-support/openldap/openldap/0001-ITS-10094-libldap-OpenSSL-fix-setting-ciphersuites.patch
new file mode 100644
index 0000000000..211dbe99bf
--- /dev/null
+++ b/meta-oe/recipes-support/openldap/openldap/0001-ITS-10094-libldap-OpenSSL-fix-setting-ciphersuites.patch
@@ -0,0 +1,69 @@
+From 7cee69298857e2393799780ee472dfe0a378ee2d Mon Sep 17 00:00:00 2001
+From: Howard Chu <hyc@openldap.org>
+Date: Thu, 12 Oct 2023 17:22:48 +0100
+Subject: [PATCH] ITS#10094 libldap/OpenSSL: fix setting ciphersuites
+
+Don't try old-style ciphersuite list if only v1.3 or newer ciphers were specified
+
+Upstream-Status: Backport from https://git.openldap.org/openldap/openldap/-/merge_requests/654/diffs?commit_id=8c482cec9a68e74b3609b1e44738bee352f6577a
+
+Signed-off-by: Priyal Doshi <pdoshi@mvista.com>
+---
+ libraries/libldap/tls_o.c | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/libraries/libldap/tls_o.c b/libraries/libldap/tls_o.c
+index d6405bc..4123a9b 100644
+--- a/libraries/libldap/tls_o.c
++++ b/libraries/libldap/tls_o.c
+@@ -294,7 +294,7 @@ tlso_stecpy( char *dst, const char *src, const char *end )
+ * Try to find any TLS1.3 ciphers in the given list of suites.
+ */
+ static void
+-tlso_ctx_cipher13( tlso_ctx *ctx, char *suites )
++tlso_ctx_cipher13( tlso_ctx *ctx, char *suites, char **oldsuites )
+ {
+ char tls13_suites[1024], *ts = tls13_suites, *te = tls13_suites + sizeof(tls13_suites);
+ char *ptr, *colon, *nptr;
+@@ -303,6 +303,8 @@ tlso_ctx_cipher13( tlso_ctx *ctx, char *suites )
+ SSL *s = SSL_new( ctx );
+ int ret;
+
++ *oldsuites = NULL;
++
+ if ( !s )
+ return;
+
+@@ -334,8 +336,15 @@ tlso_ctx_cipher13( tlso_ctx *ctx, char *suites )
+ if ( tls13_suites[0] )
+ ts = tlso_stecpy( ts, ":", te );
+ ts = tlso_stecpy( ts, nptr, te );
++ } else if (! *oldsuites) {
++ /* should never happen, set_ciphersuites should
++ * only succeed for TLSv1.3 and above
++ */
++ *oldsuites = ptr;
+ }
+ }
++ } else if (! *oldsuites) {
++ *oldsuites = ptr;
+ }
+ if ( !colon || ts >= te )
+ break;
+@@ -415,10 +424,11 @@ tlso_ctx_init( struct ldapoptions *lo, struct ldaptls *lt, int is_server )
+ }
+
+ if ( lo->ldo_tls_ciphersuite ) {
++ char *oldsuites = lt->lt_ciphersuite;
+ #if OPENSSL_VERSION_NUMBER >= 0x10101000
+- tlso_ctx_cipher13( ctx, lt->lt_ciphersuite );
++ tlso_ctx_cipher13( ctx, lt->lt_ciphersuite, &oldsuites );
+ #endif
+- if ( !SSL_CTX_set_cipher_list( ctx, lt->lt_ciphersuite ) )
++ if ( oldsuites && !SSL_CTX_set_cipher_list( ctx, oldsuites ) )
+ {
+ Debug1( LDAP_DEBUG_ANY,
+ "TLS: could not set cipher list %s.\n",
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/openldap/openldap/0001-ldif-filter-fix-parallel-build-failure.patch b/meta-oe/recipes-support/openldap/openldap/0001-ldif-filter-fix-parallel-build-failure.patch
deleted file mode 100644
index b42bd9764f..0000000000
--- a/meta-oe/recipes-support/openldap/openldap/0001-ldif-filter-fix-parallel-build-failure.patch
+++ /dev/null
@@ -1,32 +0,0 @@
-From 9e4ccd1e78ceac8de1ab66ee62ee216f1fbd4956 Mon Sep 17 00:00:00 2001
-From: Yi Zhao <yi.zhao@windriver.com>
-Date: Thu, 2 Dec 2021 11:38:15 +0800
-Subject: [PATCH] ldif-filter: fix parallel build failure
-
-Add slapd-common.o as dependency for ldif-filter to fix the parallel
-build failure:
- ld: cannot find slapd-common.o: No such file or directory
-
-Upstream-Status: Pending
-
-Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
----
- tests/progs/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/tests/progs/Makefile.in b/tests/progs/Makefile.in
-index 13f1e8be2..e4f4ccf98 100644
---- a/tests/progs/Makefile.in
-+++ b/tests/progs/Makefile.in
-@@ -56,7 +56,7 @@ slapd-modify: slapd-modify.o $(OBJS) $(XLIBS)
- slapd-bind: slapd-bind.o $(OBJS) $(XLIBS)
- $(LTLINK) -o $@ slapd-bind.o $(OBJS) $(LIBS)
-
--ldif-filter: ldif-filter.o $(XLIBS)
-+ldif-filter: ldif-filter.o $(OBJS) $(XLIBS)
- $(LTLINK) -o $@ ldif-filter.o $(OBJS) $(LIBS)
-
- slapd-mtread: slapd-mtread.o $(OBJS) $(XLIBS)
---
-2.25.1
-
diff --git a/meta-oe/recipes-support/openldap/openldap/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch b/meta-oe/recipes-support/openldap/openldap/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch
deleted file mode 100644
index 552726bb0a..0000000000
--- a/meta-oe/recipes-support/openldap/openldap/0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 690f69791eb6cd0d7e94b4d73219ee864de27f62 Mon Sep 17 00:00:00 2001
-From: Yi Zhao <yi.zhao@windriver.com>
-Date: Mon, 10 Jan 2022 10:13:51 +0800
-Subject: [PATCH] libraries/Makefile.in: ignore the mkdir errors
-
-Ignore the mkdir errors to fix the parallel build failure:
-
-../../build/shtool mkdir -p TOPDIR/tmp-glibc/work/cortexa15t2hf-neon-wrs-linux-gnueabi/openldap/2.5.9-r0/image/usr/lib
-mkdir: cannot create directory 'TOPDIR/tmp-glibc/work/cortexa15t2hf-neon-wrs-linux-gnueabi/openldap/2.5.9-r0/image/usr/lib': File exists
-
-Upstream-Status: Pending
-
-Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
----
- libraries/Makefile.in | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/libraries/Makefile.in b/libraries/Makefile.in
-index d9cb2ff..c6b251f 100644
---- a/libraries/Makefile.in
-+++ b/libraries/Makefile.in
-@@ -24,7 +24,7 @@ PKGCONFIG_DIR=$(DESTDIR)$(libdir)/pkgconfig
- PKGCONFIG_SRCDIRS=liblber libldap
-
- install-local:
-- @$(MKDIR) $(PKGCONFIG_DIR)
-+ @-$(MKDIR) $(PKGCONFIG_DIR)
- @for i in $(PKGCONFIG_SRCDIRS); do \
- $(INSTALL_DATA) $$i/*.pc $(PKGCONFIG_DIR); \
- done
---
-2.17.1
-
diff --git a/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch b/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch
deleted file mode 100644
index bcd1525b67..0000000000
--- a/meta-oe/recipes-support/openldap/openldap/0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch
+++ /dev/null
@@ -1,54 +0,0 @@
-From 79381ab335898c9184e22dd25b544adefa9bf6c5 Mon Sep 17 00:00:00 2001
-From: Khem Raj <raj.khem@gmail.com>
-Date: Mon, 7 Feb 2022 16:26:57 -0800
-Subject: [PATCH] librewrite: include ldap_pvt_thread.h before redefining
- calloc
-
-This helps compiling with musl, where sched.h is included by
-ldap_pvt_thread.h which provides prototype for calloc() and conflicts
-
-/usr/include/sched.h:84:7: error: conflicting types for 'ber_memcalloc'
-| void *calloc(size_t, size_t);
-| ^1
-| warning and 1 error generated.
-| ./rewrite-int.h:44:21: note: expanded from macro 'calloc'
-| #define calloc(x,y) ber_memcalloc(x,y)
-| ^
-
-Upstream-Status: Pending
-Signed-off-by: Khem Raj <raj.khem@gmail.com>
----
- libraries/librewrite/rewrite-int.h | 10 +++++-----
- 1 file changed, 5 insertions(+), 5 deletions(-)
-
-diff --git a/libraries/librewrite/rewrite-int.h b/libraries/librewrite/rewrite-int.h
-index 4481dd3..5ec226d 100644
---- a/libraries/librewrite/rewrite-int.h
-+++ b/libraries/librewrite/rewrite-int.h
-@@ -40,6 +40,11 @@
-
- #include <rewrite.h>
-
-+#ifndef NO_THREADS
-+#define USE_REWRITE_LDAP_PVT_THREADS
-+#include <ldap_pvt_thread.h>
-+#endif
-+
- #define malloc(x) ber_memalloc(x)
- #define calloc(x,y) ber_memcalloc(x,y)
- #define realloc(x,y) ber_memrealloc(x,y)
-@@ -47,11 +52,6 @@
- #undef strdup
- #define strdup(x) ber_strdup(x)
-
--#ifndef NO_THREADS
--#define USE_REWRITE_LDAP_PVT_THREADS
--#include <ldap_pvt_thread.h>
--#endif
--
- /*
- * For details, see RATIONALE.
- */
---
-2.35.1
-
diff --git a/meta-oe/recipes-support/openldap/openldap_2.5.12.bb b/meta-oe/recipes-support/openldap/openldap_2.5.16.bb
index e4475e5069..7e1c8fde19 100644
--- a/meta-oe/recipes-support/openldap/openldap_2.5.12.bb
+++ b/meta-oe/recipes-support/openldap/openldap_2.5.16.bb
@@ -19,13 +19,11 @@ SRC_URI = "http://www.openldap.org/software/download/OpenLDAP/openldap-release/$
file://initscript \
file://slapd.service \
file://remove-user-host-pwd-from-version.patch \
- file://0001-ldif-filter-fix-parallel-build-failure.patch \
file://0001-build-top.mk-unset-STRIP_OPTS.patch \
- file://0001-libraries-Makefile.in-ignore-the-mkdir-errors.patch \
- file://0001-librewrite-include-ldap_pvt_thread.h-before-redefini.patch \
+ file://0001-ITS-10094-libldap-OpenSSL-fix-setting-ciphersuites.patch \
"
-SRC_URI[sha256sum] = "d5086cbfc49597fa7d0670a429a9054552d441b16ee8b2435412797ab0e37b96"
+SRC_URI[sha256sum] = "546ba591822e8bb0e467d40c4d4a30f89d937c3a507fe83a578f582f6a211327"
DEPENDS = "util-linux groff-native"
diff --git a/meta-oe/recipes-support/opensc/files/CVE-2023-2977.patch b/meta-oe/recipes-support/opensc/files/CVE-2023-2977.patch
new file mode 100644
index 0000000000..6a635a7ce6
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/files/CVE-2023-2977.patch
@@ -0,0 +1,53 @@
+commit 81944d1529202bd28359bede57c0a15deb65ba8a
+Author: fullwaywang <fullwaywang@tencent.com>
+Date: Mon May 29 10:38:48 2023 +0800
+Subject: [PATCH] pkcs15init: correct left length calculation to fix buffer overrun bug.
+
+ Fixes #2785
+
+CVE: CVE-2023-2977
+
+Upstream-Status: Backport [https://github.com/OpenSC/OpenSC/pull/2787/commits/3bf3ab2f9091f984cda6dd910654ccbbe3f06a40]
+
+Signed-off-by: Soumya <soumya.sambu@windriver.com>
+---
+
+diff --git a/src/pkcs15init/pkcs15-cardos.c b/src/pkcs15init/pkcs15-cardos.c
+index 9715cf39..f41f73c3 100644
+--- a/src/pkcs15init/pkcs15-cardos.c
++++ b/src/pkcs15init/pkcs15-cardos.c
+@@ -872,7 +872,7 @@ static int cardos_have_verifyrc_package(sc_card_t *card)
+ sc_apdu_t apdu;
+ u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];
+ int r;
+- const u8 *p = rbuf, *q;
++ const u8 *p = rbuf, *q, *pp;
+ size_t len, tlen = 0, ilen = 0;
+
+ sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x88);
+@@ -888,13 +888,13 @@ static int cardos_have_verifyrc_package(sc_card_t *card)
+ return 0;
+
+ while (len != 0) {
+- p = sc_asn1_find_tag(card->ctx, p, len, 0xe1, &tlen);
+- if (p == NULL)
++ pp = sc_asn1_find_tag(card->ctx, p, len, 0xe1, &tlen);
++ if (pp == NULL)
+ return 0;
+ if (card->type == SC_CARD_TYPE_CARDOS_M4_3) {
+ /* the verifyRC package on CardOS 4.3B use Manufacturer ID 0x01 */
+ /* and Package Number 0x07 */
+- q = sc_asn1_find_tag(card->ctx, p, tlen, 0x01, &ilen);
++ q = sc_asn1_find_tag(card->ctx, pp, tlen, 0x01, &ilen);
+ if (q == NULL || ilen != 4)
+ return 0;
+ if (q[0] == 0x07)
+@@ -902,7 +902,7 @@ static int cardos_have_verifyrc_package(sc_card_t *card)
+ } else if (card->type == SC_CARD_TYPE_CARDOS_M4_4) {
+ /* the verifyRC package on CardOS 4.4 use Manufacturer ID 0x03 */
+ /* and Package Number 0x02 */
+- q = sc_asn1_find_tag(card->ctx, p, tlen, 0x03, &ilen);
++ q = sc_asn1_find_tag(card->ctx, pp, tlen, 0x03, &ilen);
+ if (q == NULL || ilen != 4)
+ return 0;
+ if (q[0] == 0x02)
diff --git a/meta-oe/recipes-support/opensc/opensc/CVE-2023-40660.patch b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40660.patch
new file mode 100644
index 0000000000..74e547298f
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40660.patch
@@ -0,0 +1,55 @@
+Origin: https://github.com/OpenSC/OpenSC/commit/868f76fb31255fd3fdacfc3e476452efeb61c3e7
+From: Frank Morgner <frankmorgner@gmail.com>
+Date: Wed, 21 Jun 2023 12:27:23 +0200
+Subject: Fixed PIN authentication bypass
+
+If two processes are accessing a token, then one process may leave the
+card usable with an authenticated PIN so that a key may sign/decrypt any
+data. This is especially the case if the token does not support a way of
+resetting the authentication status (logout).
+
+We have some tracking of the authentication status in software via
+PKCS#11, Minidriver (os-wise) and CryptoTokenKit, which is why a
+PIN-prompt will appear even though the card may technically be unlocked
+as described in the above example. However, before this change, an empty
+PIN was not verified (likely yielding an error during PIN-verification),
+but it was just checked whether the PIN is authenticated. This defeats
+the purpose of the PIN verification, because an empty PIN is not the
+correct one. Especially during OS Logon, we don't want that kind of
+shortcut, but we want the user to verify the correct PIN (even though
+the token was left unattended and authentication at the computer).
+
+This essentially reverts commit e6f7373ef066cfab6e3162e8b5f692683db23864.
+
+CVE: CVE-2023-40660
+Upstream-Status: Backport [https://salsa.debian.org/opensc-team/opensc/-/commit/940e8bc764047c873f88bb1396933a5368d03533]
+Signed-off-by: Virendra Thakur <virendrak@kpit.com>
+---
+ src/libopensc/pkcs15-pin.c | 13 -------------
+ 1 file changed, 13 deletions(-)
+
+diff --git a/src/libopensc/pkcs15-pin.c b/src/libopensc/pkcs15-pin.c
+index 80a185fecd..393234efe4 100644
+--- a/src/libopensc/pkcs15-pin.c
++++ b/src/libopensc/pkcs15-pin.c
+@@ -307,19 +307,6 @@
+ LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_PIN_REFERENCE);
+ auth_info = (struct sc_pkcs15_auth_info *)pin_obj->data;
+
+- /*
+- * if pin cache is disabled, we can get here with no PIN data.
+- * in this case, to avoid error or unnecessary pin prompting on pinpad,
+- * check if the PIN has been already verified and the access condition
+- * is still open on card.
+- */
+- if (pinlen == 0) {
+- r = sc_pkcs15_get_pin_info(p15card, pin_obj);
+-
+- if (r == SC_SUCCESS && auth_info->logged_in == SC_PIN_STATE_LOGGED_IN)
+- LOG_FUNC_RETURN(ctx, r);
+- }
+-
+ r = _validate_pin(p15card, auth_info, pinlen);
+
+ if (r)
+
diff --git a/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-1.patch b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-1.patch
new file mode 100644
index 0000000000..3ecff558cf
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-1.patch
@@ -0,0 +1,47 @@
+Origin: https://github.com/OpenSC/OpenSC/commit/245efe608d083fd4e4ec96793fdefd218e26fde7
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Thu, 17 Aug 2023 13:54:42 +0200
+Subject: pkcs15: Avoid buffer overflow when getting last update
+
+Thanks oss-fuzz
+
+https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60769
+
+CVE: CVE-2023-40661
+Upstream-Status: Backport [https://salsa.debian.org/opensc-team/opensc/-/commit/8026fb4ca0ed53d970c6c497252eb264d4192d50]
+Signed-off-by: Virendra Thakur <virendrak@kpit.com>
+Comment: Hunk refreshed based on codebase.
+
+---
+ src/libopensc/pkcs15.c | 16 +++++++++-------
+ 1 file changed, 9 insertions(+), 7 deletions(-)
+
+diff --git a/src/libopensc/pkcs15.c b/src/libopensc/pkcs15.c
+index eb7fc6afcd..4215b733a8 100644
+--- a/src/libopensc/pkcs15.c
++++ b/src/libopensc/pkcs15.c
+@@ -528,7 +528,7 @@
+ struct sc_context *ctx = p15card->card->ctx;
+ struct sc_file *file = NULL;
+ struct sc_asn1_entry asn1_last_update[C_ASN1_LAST_UPDATE_SIZE];
+- unsigned char *content, last_update[32];
++ unsigned char *content, last_update[32] = {0};
+ size_t lupdate_len = sizeof(last_update) - 1;
+ int r, content_len;
+ size_t size;
+@@ -564,9 +564,11 @@
+ if (r < 0)
+ return NULL;
+
+- p15card->tokeninfo->last_update.gtime = strdup((char *)last_update);
+- if (!p15card->tokeninfo->last_update.gtime)
+- return NULL;
++ if (asn1_last_update[0].flags & SC_ASN1_PRESENT) {
++ p15card->tokeninfo->last_update.gtime = strdup((char *)last_update);
++ if (!p15card->tokeninfo->last_update.gtime)
++ return NULL;
++ }
+ done:
+ sc_log(ctx, "lastUpdate.gtime '%s'", p15card->tokeninfo->last_update.gtime);
+ return p15card->tokeninfo->last_update.gtime;
+
diff --git a/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-2.patch b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-2.patch
new file mode 100644
index 0000000000..39e729c5a9
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-2.patch
@@ -0,0 +1,32 @@
+Origin: https://github.com/OpenSC/OpenSC/commit/440ca666eff10cc7011901252d20f3fc4ea23651
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Thu, 17 Aug 2023 13:41:36 +0200
+Subject: setcos: Avoid buffer underflow
+
+Thanks oss-fuzz
+
+https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60672
+CVE: CVE-2023-40661
+Upstream-Status: Backport [https://salsa.debian.org/opensc-team/opensc/-/commit/8026fb4ca0ed53d970c6c497252eb264d4192d50]
+Signed-off-by: Virendra Thakur <virendrak@kpit.com>
+Comment: Hunk refreshed based on codebase.
+---
+ src/pkcs15init/pkcs15-setcos.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/src/pkcs15init/pkcs15-setcos.c b/src/pkcs15init/pkcs15-setcos.c
+index 1b56afe6d9..1907b47f9d 100644
+--- a/src/pkcs15init/pkcs15-setcos.c
++++ b/src/pkcs15init/pkcs15-setcos.c
+@@ -346,6 +346,10 @@
+
+ /* Replace the path of instantiated key template by the path from the object data. */
+ memcpy(&file->path, &key_info->path, sizeof(file->path));
++ if (file->path.len < 2) {
++ sc_file_free(file);
++ LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, "Invalid path");
++ }
+ file->id = file->path.value[file->path.len - 2] * 0x100
+ + file->path.value[file->path.len - 1];
+
+
diff --git a/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-3.patch b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-3.patch
new file mode 100644
index 0000000000..7950cf91df
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-3.patch
@@ -0,0 +1,31 @@
+Origin: https://github.com/OpenSC/OpenSC/commit/41d61da8481582e12710b5858f8b635e0a71ab5e
+From: Jakub Jelen <jjelen@redhat.com>
+Date: Wed, 20 Sep 2023 10:13:57 +0200
+Subject: oberthur: Avoid buffer overflow
+
+Thanks oss-fuzz
+
+https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=60650
+CVE: CVE-2023-40661
+Upstream-Status: Backport [https://salsa.debian.org/opensc-team/opensc/-/commit/8026fb4ca0ed53d970c6c497252eb264d4192d50]
+Signed-off-by: Virendra Thakur <virendrak@kpit.com>
+Comment: Hunk refreshed based on codebase.
+---
+ src/pkcs15init/pkcs15-oberthur.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/pkcs15init/pkcs15-oberthur.c b/src/pkcs15init/pkcs15-oberthur.c
+index ad2cabd530..c441ab1e76 100644
+--- a/src/pkcs15init/pkcs15-oberthur.c
++++ b/src/pkcs15init/pkcs15-oberthur.c
+@@ -688,6 +688,9 @@
+ if (object->type != SC_PKCS15_TYPE_PRKEY_RSA)
+ LOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, "Create key failed: RSA only supported");
+
++ if (key_info->path.len < 2)
++ LOG_TEST_RET(ctx, SC_ERROR_OBJECT_NOT_VALID, "The path needs to be at least to bytes long");
++
+ sc_log(ctx, "create private key ID:%s", sc_pkcs15_print_id(&key_info->id));
+ /* Here, the path of private key file should be defined.
+ * Nevertheless, we need to instantiate private key to get the ACLs. */
+
diff --git a/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-4.patch b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-4.patch
new file mode 100644
index 0000000000..797f8ad3b1
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-4.patch
@@ -0,0 +1,28 @@
+Origin: https://github.com/OpenSC/OpenSC/commit/578aed8391ef117ca64a9e0cba8e5c264368a0ec
+From: Frank Morgner <frankmorgner@gmail.com>
+Date: Thu, 8 Dec 2022 00:27:18 +0100
+Subject: sc_pkcs15init_rmdir: prevent out of bounds write
+
+fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=53927
+CVE: CVE-2023-40661
+Upstream-Status: Backport [https://salsa.debian.org/opensc-team/opensc/-/commit/8026fb4ca0ed53d970c6c497252eb264d4192d50]
+Signed-off-by: Virendra Thakur <virendrak@kpit.com>
+Comment: Hunk refreshed based on codebase.
+---
+ src/pkcs15init/pkcs15-lib.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/pkcs15init/pkcs15-lib.c b/src/pkcs15init/pkcs15-lib.c
+index 91cee37310..3df03c6e1f 100644
+--- a/src/pkcs15init/pkcs15-lib.c
++++ b/src/pkcs15init/pkcs15-lib.c
+@@ -666,6 +666,8 @@
+
+ path = df->path;
+ path.len += 2;
++ if (path.len > SC_MAX_PATH_SIZE)
++ return SC_ERROR_INTERNAL;
+
+ nfids = r / 2;
+ while (r >= 0 && nfids--) {
+
diff --git a/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-5.patch b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-5.patch
new file mode 100644
index 0000000000..e173e65575
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-5.patch
@@ -0,0 +1,30 @@
+Origin: https://github.com/OpenSC/OpenSC/commit/c449a181a6988cc1e8dc8764d23574e48cdc3fa6
+From: =?UTF-8?q?Veronika=20Hanul=C3=ADkov=C3=A1?= <vhanulik@redhat.com>
+Date: Mon, 19 Jun 2023 16:14:51 +0200
+Subject: pkcs15-cflex: check path length to prevent underflow
+
+Thanks OSS-Fuzz
+https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=58932
+CVE: CVE-2023-40661
+Upstream-Status: Backport [https://salsa.debian.org/opensc-team/opensc/-/commit/8026fb4ca0ed53d970c6c497252eb264d4192d50]
+Signed-off-by: Virendra Thakur <virendrak@kpit.com>
+Comment: Hunk refreshed based on codebase.
+---
+ src/pkcs15init/pkcs15-cflex.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/pkcs15init/pkcs15-cflex.c b/src/pkcs15init/pkcs15-cflex.c
+index d06568073d..ce1d48e62c 100644
+--- a/src/pkcs15init/pkcs15-cflex.c
++++ b/src/pkcs15init/pkcs15-cflex.c
+@@ -56,6 +56,9 @@
+ int r = 0;
+ /* Select the parent DF */
+ path = df->path;
++ if (path.len < 2) {
++ return SC_ERROR_INVALID_ARGUMENTS;
++ }
+ path.len -= 2;
+ r = sc_select_file(p15card->card, &path, &parent);
+ if (r < 0)
+
diff --git a/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-6.patch b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-6.patch
new file mode 100644
index 0000000000..abb524de29
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-6.patch
@@ -0,0 +1,30 @@
+Origin: https://github.com/OpenSC/OpenSC/commit/df5a176bfdf8c52ba89c7fef1f82f6f3b9312bc1
+From: Veronika Hanulikova <xhanulik@fi.muni.cz>
+Date: Fri, 10 Feb 2023 11:47:34 +0100
+Subject: Check array bounds
+
+Thanks OSS-Fuzz
+https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=54312
+CVE: CVE-2023-40661
+Upstream-Status: Backport [https://salsa.debian.org/opensc-team/opensc/-/commit/8026fb4ca0ed53d970c6c497252eb264d4192d50]
+Signed-off-by: Virendra Thakur <virendrak@kpit.com>
+Comment: Hunk refreshed based on codebase.
+---
+ src/libopensc/muscle.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/src/libopensc/muscle.c b/src/libopensc/muscle.c
+index 61a4ec24d8..9d01e0c113 100644
+--- a/src/libopensc/muscle.c
++++ b/src/libopensc/muscle.c
+@@ -183,6 +183,9 @@
+ sc_apdu_t apdu;
+ int r;
+
++ if (dataLength + 9 > MSC_MAX_APDU)
++ return SC_ERROR_INVALID_ARGUMENTS;
++
+ sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x54, 0x00, 0x00);
+ apdu.lc = dataLength + 9;
+ if (card->ctx->debug >= 2)
+
diff --git a/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-7.patch b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-7.patch
new file mode 100644
index 0000000000..858a996ed7
--- /dev/null
+++ b/meta-oe/recipes-support/opensc/opensc/CVE-2023-40661-7.patch
@@ -0,0 +1,40 @@
+Origin: https://github.com/OpenSC/OpenSC/commit/5631e9843c832a99769def85b7b9b68b4e3e3959
+From: Veronika Hanulikova <xhanulik@fi.muni.cz>
+Date: Fri, 3 Mar 2023 16:07:38 +0100
+Subject: Check length of string before making copy
+
+Thanks OSS-Fuzz
+https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55851
+https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=55998
+CVE: CVE-2023-40661
+Upstream-Status: Backport [https://salsa.debian.org/opensc-team/opensc/-/commit/8026fb4ca0ed53d970c6c497252eb264d4192d50]
+Signed-off-by: Virendra Thakur <virendrak@kpit.com>
+Comment: Hunk refreshed based on codebase.
+---
+ src/pkcs15init/profile.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/src/pkcs15init/profile.c b/src/pkcs15init/profile.c
+index 2b793b0282..3bad1e8536 100644
+--- a/src/pkcs15init/profile.c
++++ b/src/pkcs15init/profile.c
+@@ -1465,6 +1465,8 @@
+ while (argc--) {
+ unsigned int op, method, id;
+
++ if (strlen(*argv) >= sizeof(oper))
++ goto bad;
+ strlcpy(oper, *argv++, sizeof(oper));
+ if ((what = strchr(oper, '=')) == NULL)
+ goto bad;
+@@ -2128,6 +2130,9 @@
+ return get_uint(cur, value, type);
+ }
+
++ if (strlen(value) >= sizeof(temp))
++ return 1;
++
+ n = strcspn(value, "0123456789x");
+ strlcpy(temp, value, (sizeof(temp) > n) ? n + 1 : sizeof(temp));
+
+
diff --git a/meta-oe/recipes-support/opensc/opensc_0.22.0.bb b/meta-oe/recipes-support/opensc/opensc_0.22.0.bb
index f8b4af0c4f..770c2d686b 100644
--- a/meta-oe/recipes-support/opensc/opensc_0.22.0.bb
+++ b/meta-oe/recipes-support/opensc/opensc_0.22.0.bb
@@ -14,7 +14,21 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=cb8aedd3bced19bd8026d96a8b6876d7"
#v0.21.0
SRCREV = "c902e1992195e00ada12d71beb1029287cd72037"
SRC_URI = "git://github.com/OpenSC/OpenSC;branch=master;protocol=https \
+ file://CVE-2023-2977.patch \
+ file://CVE-2023-40660.patch \
+ file://CVE-2023-40661-1.patch \
+ file://CVE-2023-40661-2.patch \
+ file://CVE-2023-40661-3.patch \
+ file://CVE-2023-40661-4.patch \
+ file://CVE-2023-40661-5.patch \
+ file://CVE-2023-40661-6.patch \
+ file://CVE-2023-40661-7.patch \
"
+
+# CVE-2021-34193 is a duplicate CVE covering the 5 individual
+# https://github.com/OpenSC/OpenSC/pull/2855/commits/7a049fc3922060fb75cb9fea9e58eef9edc357ae
+CVE_CHECK_IGNORE += "CVE-2021-34193"
+
DEPENDS = "virtual/libiconv openssl"
S = "${WORKDIR}/git"
diff --git a/meta-oe/recipes-support/poppler/poppler/0001-JBIG2Stream-Fix-crash-on-broken-file.patch b/meta-oe/recipes-support/poppler/poppler/0001-JBIG2Stream-Fix-crash-on-broken-file.patch
new file mode 100644
index 0000000000..4a8ea233c8
--- /dev/null
+++ b/meta-oe/recipes-support/poppler/poppler/0001-JBIG2Stream-Fix-crash-on-broken-file.patch
@@ -0,0 +1,41 @@
+From 27354e9d9696ee2bc063910a6c9a6b27c5184a52 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Thu, 25 Aug 2022 00:14:22 +0200
+Subject: [PATCH] JBIG2Stream: Fix crash on broken file
+
+https://github.com/jeffssh/CVE-2021-30860
+
+Thanks to David Warren for the heads up
+
+CVE: CVE-2021-30860
+
+References:
+https://nvd.nist.gov/vuln/detail/CVE-2021-30860
+
+Upstream-Status: Backport
+[https://gitlab.freedesktop.org/poppler/poppler/-/commit/27354e9d9696ee2bc063910a6c9a6b27c5184a52]
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ poppler/JBIG2Stream.cc | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
+index 662276e5..9f70431d 100644
+--- a/poppler/JBIG2Stream.cc
++++ b/poppler/JBIG2Stream.cc
+@@ -1976,7 +1976,11 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm, bool lossless
+ for (i = 0; i < nRefSegs; ++i) {
+ if ((seg = findSegment(refSegs[i]))) {
+ if (seg->getType() == jbig2SegSymbolDict) {
+- numSyms += ((JBIG2SymbolDict *)seg)->getSize();
++ const unsigned int segSize = ((JBIG2SymbolDict *)seg)->getSize();
++ if (unlikely(checkedAdd(numSyms, segSize, &numSyms))) {
++ error(errSyntaxError, getPos(), "Too many symbols in JBIG2 text region");
++ return;
++ }
+ } else if (seg->getType() == jbig2SegCodeTable) {
+ codeTables.push_back(seg);
+ }
+--
+2.25.1
diff --git a/meta-oe/recipes-support/poppler/poppler/CVE-2023-34872.patch b/meta-oe/recipes-support/poppler/poppler/CVE-2023-34872.patch
new file mode 100644
index 0000000000..7fdc293aac
--- /dev/null
+++ b/meta-oe/recipes-support/poppler/poppler/CVE-2023-34872.patch
@@ -0,0 +1,46 @@
+From 591235c8b6c65a2eee88991b9ae73490fd9afdfe Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <aacid@kde.org>
+Date: Fri, 18 Aug 2023 08:22:06 +0000
+Subject: [PATCH] OutlineItem::open: Fix crash on malformed files
+
+Fixes #1399
+
+CVE: CVE-2023-34872
+
+Upstream-Status: Backport [https://gitlab.freedesktop.org/poppler/poppler/-/commit/591235c8b6c65a2eee88991b9ae73490fd9afdfe]
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ poppler/Outline.cc | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/poppler/Outline.cc b/poppler/Outline.cc
+index cbb6cb4..4c68be9 100644
+--- a/poppler/Outline.cc
++++ b/poppler/Outline.cc
+@@ -14,7 +14,7 @@
+ // under GPL version 2 or later
+ //
+ // Copyright (C) 2005 Marco Pesenti Gritti <mpg@redhat.com>
+-// Copyright (C) 2008, 2016-2019, 2021 Albert Astals Cid <aacid@kde.org>
++// Copyright (C) 2008, 2016-2019, 2021, 2023 Albert Astals Cid <aacid@kde.org>
+ // Copyright (C) 2009 Nick Jones <nick.jones@network-box.com>
+ // Copyright (C) 2016 Jason Crain <jason@aquaticape.us>
+ // Copyright (C) 2017 Adrian Johnson <ajohnson@redneon.com>
+@@ -483,8 +483,12 @@ void OutlineItem::open()
+ {
+ if (!kids) {
+ Object itemDict = xref->fetch(ref);
+- const Object &firstRef = itemDict.dictLookupNF("First");
+- kids = readItemList(this, &firstRef, xref, doc);
++ if (itemDict.isDict()) {
++ const Object &firstRef = itemDict.dictLookupNF("First");
++ kids = readItemList(this, &firstRef, xref, doc);
++ } else {
++ kids = new std::vector<OutlineItem *>();
++ }
+ }
+ }
+
+--
+2.35.5
diff --git a/meta-oe/recipes-support/poppler/poppler_22.04.0.bb b/meta-oe/recipes-support/poppler/poppler_22.04.0.bb
index b7cdb4f1be..04106f11aa 100644
--- a/meta-oe/recipes-support/poppler/poppler_22.04.0.bb
+++ b/meta-oe/recipes-support/poppler/poppler_22.04.0.bb
@@ -6,6 +6,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=751419260aa954499f7abaabaa882bbe"
SRC_URI = "http://poppler.freedesktop.org/${BP}.tar.xz \
file://0001-Do-not-overwrite-all-our-build-flags.patch \
file://basename-include.patch \
+ file://0001-JBIG2Stream-Fix-crash-on-broken-file.patch \
+ file://CVE-2023-34872.patch \
"
SRC_URI[sha256sum] = "813fb4b90e7bda63df53205c548602bae728887a60f4048aae4dbd9b1927deff"
diff --git a/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0001.patch b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0001.patch
new file mode 100644
index 0000000000..7d1dd6582f
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0001.patch
@@ -0,0 +1,65 @@
+From b5a060f2ebb8d794f508436a12e4d4163f94b1b8 Mon Sep 17 00:00:00 2001
+From: Laszlo Varady <laszlo.varady@protonmail.com>
+Date: Sat, 20 Aug 2022 12:26:05 +0200
+Subject: [PATCH 1/8] syslogformat: fix out-of-bounds reading of data buffer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CVE: CVE-2022-38725
+
+Upstream-Status: Backport
+[https://github.com/syslog-ng/syslog-ng/commit/b5a060f2ebb8d794f508436a12e4d4163f94b1b8]
+
+Signed-off-by: László Várady <laszlo.varady@protonmail.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ modules/syslogformat/syslog-format.c | 10 +++++++---
+ 1 file changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/modules/syslogformat/syslog-format.c b/modules/syslogformat/syslog-format.c
+index aacb525b3..872cc1d71 100644
+--- a/modules/syslogformat/syslog-format.c
++++ b/modules/syslogformat/syslog-format.c
+@@ -223,6 +223,9 @@ log_msg_parse_cisco_timestamp_attributes(LogMessage *self, const guchar **data,
+ const guchar *src = *data;
+ gint left = *length;
+
++ if (!left)
++ return;
++
+ /* Cisco timestamp extensions, the first '*' indicates that the clock is
+ * unsynced, '.' if it is known to be synced */
+ if (G_UNLIKELY(src[0] == '*'))
+@@ -562,7 +565,7 @@ log_msg_parse_sd(LogMessage *self, const guchar **data, gint *length, const MsgF
+ open_sd++;
+ do
+ {
+- if (!isascii(*src) || *src == '=' || *src == ' ' || *src == ']' || *src == '"')
++ if (!left || !isascii(*src) || *src == '=' || *src == ' ' || *src == ']' || *src == '"')
+ goto error;
+ /* read sd_id */
+ pos = 0;
+@@ -595,7 +598,8 @@ log_msg_parse_sd(LogMessage *self, const guchar **data, gint *length, const MsgF
+ sd_id_len = pos;
+ strcpy(sd_value_name, logmsg_sd_prefix);
+ strncpy(sd_value_name + logmsg_sd_prefix_len, sd_id_name, sizeof(sd_value_name) - logmsg_sd_prefix_len);
+- if (*src == ']')
++
++ if (left && *src == ']')
+ {
+ log_msg_set_value_by_name(self, sd_value_name, "", 0);
+ }
+@@ -612,7 +616,7 @@ log_msg_parse_sd(LogMessage *self, const guchar **data, gint *length, const MsgF
+ else
+ goto error;
+
+- if (!isascii(*src) || *src == '=' || *src == ' ' || *src == ']' || *src == '"')
++ if (!left || !isascii(*src) || *src == '=' || *src == ' ' || *src == ']' || *src == '"')
+ goto error;
+
+ /* read sd-param */
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0002.patch b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0002.patch
new file mode 100644
index 0000000000..9ccb24ddea
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0002.patch
@@ -0,0 +1,150 @@
+From 81a07263f1e522a376d3a30f96f51df3f2879f8a Mon Sep 17 00:00:00 2001
+From: Laszlo Varady <laszlo.varady@protonmail.com>
+Date: Sat, 20 Aug 2022 12:22:44 +0200
+Subject: [PATCH 2/8] syslogformat: add bug reproducer test for non-zero terminated
+ input
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CVE: CVE-2022-38725
+
+Upstream-Status: Backport
+[https://github.com/syslog-ng/syslog-ng/commit/81a07263f1e522a376d3a30f96f51df3f2879f8a]
+
+Signed-off-by: László Várady <laszlo.varady@protonmail.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ modules/syslogformat/CMakeLists.txt | 1 +
+ modules/syslogformat/Makefile.am | 2 +
+ modules/syslogformat/tests/CMakeLists.txt | 1 +
+ modules/syslogformat/tests/Makefile.am | 9 +++
+ .../syslogformat/tests/test_syslog_format.c | 72 +++++++++++++++++++
+ 5 files changed, 85 insertions(+)
+ create mode 100644 modules/syslogformat/tests/CMakeLists.txt
+ create mode 100644 modules/syslogformat/tests/Makefile.am
+ create mode 100644 modules/syslogformat/tests/test_syslog_format.c
+
+diff --git a/modules/syslogformat/CMakeLists.txt b/modules/syslogformat/CMakeLists.txt
+index 94ee01aa2..64848efee 100644
+--- a/modules/syslogformat/CMakeLists.txt
++++ b/modules/syslogformat/CMakeLists.txt
+@@ -14,3 +14,4 @@ add_module(
+ SOURCES ${SYSLOGFORMAT_SOURCES}
+ )
+
++add_test_subdirectory(tests)
+diff --git a/modules/syslogformat/Makefile.am b/modules/syslogformat/Makefile.am
+index f13f88c1b..14cdf589d 100644
+--- a/modules/syslogformat/Makefile.am
++++ b/modules/syslogformat/Makefile.am
+@@ -31,3 +31,5 @@ modules_syslogformat_libsyslogformat_la_DEPENDENCIES = \
+ modules/syslogformat modules/syslogformat/ mod-syslogformat: \
+ modules/syslogformat/libsyslogformat.la
+ .PHONY: modules/syslogformat/ mod-syslogformat
++
++include modules/syslogformat/tests/Makefile.am
+diff --git a/modules/syslogformat/tests/CMakeLists.txt b/modules/syslogformat/tests/CMakeLists.txt
+new file mode 100644
+index 000000000..2e45b7194
+--- /dev/null
++++ b/modules/syslogformat/tests/CMakeLists.txt
+@@ -0,0 +1 @@
++add_unit_test(CRITERION TARGET test_syslog_format DEPENDS syslogformat)
+diff --git a/modules/syslogformat/tests/Makefile.am b/modules/syslogformat/tests/Makefile.am
+new file mode 100644
+index 000000000..7ee66a59c
+--- /dev/null
++++ b/modules/syslogformat/tests/Makefile.am
+@@ -0,0 +1,9 @@
++modules_syslogformat_tests_TESTS = \
++ modules/syslogformat/tests/test_syslog_format
++
++check_PROGRAMS += ${modules_syslogformat_tests_TESTS}
++
++EXTRA_DIST += modules/syslogformat/tests/CMakeLists.txt
++
++modules_syslogformat_tests_test_syslog_format_CFLAGS = $(TEST_CFLAGS) -I$(top_srcdir)/modules/syslogformat
++modules_syslogformat_tests_test_syslog_format_LDADD = $(TEST_LDADD) $(PREOPEN_SYSLOGFORMAT)
+diff --git a/modules/syslogformat/tests/test_syslog_format.c b/modules/syslogformat/tests/test_syslog_format.c
+new file mode 100644
+index 000000000..b247fe3c5
+--- /dev/null
++++ b/modules/syslogformat/tests/test_syslog_format.c
+@@ -0,0 +1,72 @@
++/*
++ * Copyright (c) 2022 One Identity
++ * Copyright (c) 2022 László Várady
++ *
++ * This program is free software; you can redistribute it and/or modify it
++ * under the terms of the GNU General Public License version 2 as published
++ * by the Free Software Foundation, or (at your option) any later version.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
++ * GNU General Public License for more details.
++ *
++ * You should have received a copy of the GNU General Public License
++ * along with this program; if not, write to the Free Software
++ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
++ *
++ * As an additional exemption you are allowed to compile & link against the
++ * OpenSSL libraries as published by the OpenSSL project. See the file
++ * COPYING for details.
++ *
++ */
++
++#include <criterion/criterion.h>
++
++#include "apphook.h"
++#include "cfg.h"
++#include "syslog-format.h"
++#include "logmsg/logmsg.h"
++#include "msg-format.h"
++#include "scratch-buffers.h"
++
++#include <string.h>
++
++GlobalConfig *cfg;
++MsgFormatOptions parse_options;
++
++static void
++setup(void)
++{
++ app_startup();
++ syslog_format_init();
++
++ cfg = cfg_new_snippet();
++ msg_format_options_defaults(&parse_options);
++}
++
++static void
++teardown(void)
++{
++ scratch_buffers_explicit_gc();
++ app_shutdown();
++ cfg_free(cfg);
++}
++
++TestSuite(syslog_format, .init = setup, .fini = teardown);
++
++Test(syslog_format, parser_should_not_spin_on_non_zero_terminated_input, .timeout = 10)
++{
++ const gchar *data = "<182>2022-08-17T05:02:28.217 mymachine su: 'su root' failed for lonvick on /dev/pts/8";
++ /* chosen carefully to reproduce a bug */
++ gsize data_length = 27;
++
++ msg_format_options_init(&parse_options, cfg);
++ LogMessage *msg = msg_format_construct_message(&parse_options, (const guchar *) data, data_length);
++
++ gsize problem_position;
++ cr_assert(syslog_format_handler(&parse_options, msg, (const guchar *) data, data_length, &problem_position));
++
++ msg_format_options_destroy(&parse_options);
++ log_msg_unref(msg);
++}
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0003.patch b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0003.patch
new file mode 100644
index 0000000000..5801165048
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0003.patch
@@ -0,0 +1,77 @@
+From 4b8dc56ca8eaeac4c8751a305eb7eeefab8dc89d Mon Sep 17 00:00:00 2001
+From: Laszlo Varady <laszlo.varady@protonmail.com>
+Date: Sun, 21 Aug 2022 18:44:28 +0200
+Subject: [PATCH 3/8] syslogformat: fix reading cisco sequence id out of bounds
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CVE: CVE-2022-38725
+
+Upstream-Status: Backport
+[https://github.com/syslog-ng/syslog-ng/commit/4b8dc56ca8eaeac4c8751a305eb7eeefab8dc89d]
+
+Signed-off-by: László Várady <laszlo.varady@protonmail.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ modules/syslogformat/syslog-format.c | 2 +-
+ .../syslogformat/tests/test_syslog_format.c | 32 +++++++++++++++++++
+ 2 files changed, 33 insertions(+), 1 deletion(-)
+
+diff --git a/modules/syslogformat/syslog-format.c b/modules/syslogformat/syslog-format.c
+index 872cc1d71..a3d48d6f2 100644
+--- a/modules/syslogformat/syslog-format.c
++++ b/modules/syslogformat/syslog-format.c
+@@ -207,7 +207,7 @@ log_msg_parse_cisco_sequence_id(LogMessage *self, const guchar **data, gint *len
+
+ /* if the next char is not space, then we may try to read a date */
+
+- if (*src != ' ')
++ if (!left || *src != ' ')
+ return;
+
+ log_msg_set_value(self, handles.cisco_seqid, (gchar *) *data, *length - left - 1);
+diff --git a/modules/syslogformat/tests/test_syslog_format.c b/modules/syslogformat/tests/test_syslog_format.c
+index b247fe3c5..d0f5b4043 100644
+--- a/modules/syslogformat/tests/test_syslog_format.c
++++ b/modules/syslogformat/tests/test_syslog_format.c
+@@ -70,3 +70,35 @@ Test(syslog_format, parser_should_not_spin_on_non_zero_terminated_input, .timeou
+ msg_format_options_destroy(&parse_options);
+ log_msg_unref(msg);
+ }
++
++Test(syslog_format, cisco_sequence_id_non_zero_termination)
++{
++ const gchar *data = "<189>65536: ";
++ gsize data_length = strlen(data);
++
++ msg_format_options_init(&parse_options, cfg);
++ LogMessage *msg = msg_format_construct_message(&parse_options, (const guchar *) data, data_length);
++
++ gsize problem_position;
++ cr_assert(syslog_format_handler(&parse_options, msg, (const guchar *) data, data_length, &problem_position));
++ cr_assert_str_eq(log_msg_get_value_by_name(msg, ".SDATA.meta.sequenceId", NULL), "65536");
++
++ msg_format_options_destroy(&parse_options);
++ log_msg_unref(msg);
++}
++
++Test(syslog_format, minimal_non_zero_terminated_numeric_message_is_parsed_as_program_name)
++{
++ const gchar *data = "<189>65536";
++ gsize data_length = strlen(data);
++
++ msg_format_options_init(&parse_options, cfg);
++ LogMessage *msg = msg_format_construct_message(&parse_options, (const guchar *) data, data_length);
++
++ gsize problem_position;
++ cr_assert(syslog_format_handler(&parse_options, msg, (const guchar *) data, data_length, &problem_position));
++ cr_assert_str_eq(log_msg_get_value_by_name(msg, "PROGRAM", NULL), "65536");
++
++ msg_format_options_destroy(&parse_options);
++ log_msg_unref(msg);
++}
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0004.patch b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0004.patch
new file mode 100644
index 0000000000..cb81b1c122
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0004.patch
@@ -0,0 +1,37 @@
+From 73b5c300b8fde5e7a4824baa83a04931279abb37 Mon Sep 17 00:00:00 2001
+From: Laszlo Varady <laszlo.varady@protonmail.com>
+Date: Sat, 20 Aug 2022 12:42:38 +0200
+Subject: [PATCH 4/8] timeutils: fix iterating out of the range of timestamp buffer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CVE: CVE-2022-38725
+
+Upstream-Status: Backport
+[https://github.com/syslog-ng/syslog-ng/commit/73b5c300b8fde5e7a4824baa83a04931279abb37]
+
+Signed-off-by: László Várady <laszlo.varady@protonmail.com>
+Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ lib/timeutils/scan-timestamp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/lib/timeutils/scan-timestamp.c b/lib/timeutils/scan-timestamp.c
+index 304a57673..4fbe94a36 100644
+--- a/lib/timeutils/scan-timestamp.c
++++ b/lib/timeutils/scan-timestamp.c
+@@ -332,7 +332,7 @@ __parse_usec(const guchar **data, gint *length)
+ src++;
+ (*length)--;
+ }
+- while (isdigit(*src))
++ while (*length > 0 && isdigit(*src))
+ {
+ src++;
+ (*length)--;
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0005.patch b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0005.patch
new file mode 100644
index 0000000000..70964b328b
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0005.patch
@@ -0,0 +1,211 @@
+From 45f051239312e43bd4f92b9339fe67c6798a0321 Mon Sep 17 00:00:00 2001
+From: Balazs Scheidler <bazsi77@gmail.com>
+Date: Sat, 20 Aug 2022 12:43:42 +0200
+Subject: [PATCH 5/8] timeutils: add tests for non-zero terminated inputs
+
+CVE: CVE-2022-38725
+
+Upstream-Status: Backport
+[https://github.com/syslog-ng/syslog-ng/commit/45f051239312e43bd4f92b9339fe67c6798a0321]
+
+Signed-off-by: Balazs Scheidler <bazsi77@gmail.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ lib/timeutils/tests/test_scan-timestamp.c | 126 +++++++++++++++++++---
+ 1 file changed, 113 insertions(+), 13 deletions(-)
+
+diff --git a/lib/timeutils/tests/test_scan-timestamp.c b/lib/timeutils/tests/test_scan-timestamp.c
+index 27b76f12d..468bbf779 100644
+--- a/lib/timeutils/tests/test_scan-timestamp.c
++++ b/lib/timeutils/tests/test_scan-timestamp.c
+@@ -50,17 +50,21 @@ fake_time_add(time_t diff)
+ }
+
+ static gboolean
+-_parse_rfc3164(const gchar *ts, gchar isotimestamp[32])
++_parse_rfc3164(const gchar *ts, gint len, gchar isotimestamp[32])
+ {
+ UnixTime stamp;
+- const guchar *data = (const guchar *) ts;
+- gint length = strlen(ts);
++ const guchar *tsu = (const guchar *) ts;
++ gint tsu_len = len < 0 ? strlen(ts) : len;
+ GString *result = g_string_new("");
+ WallClockTime wct = WALL_CLOCK_TIME_INIT;
+
+-
++ const guchar *data = tsu;
++ gint length = tsu_len;
+ gboolean success = scan_rfc3164_timestamp(&data, &length, &wct);
+
++ cr_assert(length >= 0);
++ cr_assert(data == &tsu[tsu_len - length]);
++
+ unix_time_unset(&stamp);
+ convert_wall_clock_time_to_unix_time(&wct, &stamp);
+
+@@ -71,16 +75,21 @@ _parse_rfc3164(const gchar *ts, gchar isotimestamp[32])
+ }
+
+ static gboolean
+-_parse_rfc5424(const gchar *ts, gchar isotimestamp[32])
++_parse_rfc5424(const gchar *ts, gint len, gchar isotimestamp[32])
+ {
+ UnixTime stamp;
+- const guchar *data = (const guchar *) ts;
+- gint length = strlen(ts);
++ const guchar *tsu = (const guchar *) ts;
++ gint tsu_len = len < 0 ? strlen(ts) : len;
+ GString *result = g_string_new("");
+ WallClockTime wct = WALL_CLOCK_TIME_INIT;
+
++ const guchar *data = tsu;
++ gint length = tsu_len;
+ gboolean success = scan_rfc5424_timestamp(&data, &length, &wct);
+
++ cr_assert(length >= 0);
++ cr_assert(data == &tsu[tsu_len - length]);
++
+ unix_time_unset(&stamp);
+ convert_wall_clock_time_to_unix_time(&wct, &stamp);
+
+@@ -91,31 +100,60 @@ _parse_rfc5424(const gchar *ts, gchar isotimestamp[32])
+ }
+
+ static gboolean
+-_rfc3164_timestamp_eq(const gchar *ts, const gchar *expected, gchar converted[32])
++_rfc3164_timestamp_eq(const gchar *ts, gint len, const gchar *expected, gchar converted[32])
+ {
+- cr_assert(_parse_rfc3164(ts, converted));
++ cr_assert(_parse_rfc3164(ts, len, converted));
+ return strcmp(converted, expected) == 0;
+ }
+
+ static gboolean
+-_rfc5424_timestamp_eq(const gchar *ts, const gchar *expected, gchar converted[32])
++_rfc5424_timestamp_eq(const gchar *ts, gint len, const gchar *expected, gchar converted[32])
+ {
+- cr_assert(_parse_rfc5424(ts, converted));
++ cr_assert(_parse_rfc5424(ts, len, converted));
+ return strcmp(converted, expected) == 0;
+ }
+
+ #define _expect_rfc3164_timestamp_eq(ts, expected) \
+ ({ \
+ gchar converted[32]; \
+- cr_expect(_rfc3164_timestamp_eq(ts, expected, converted), "Parsed RFC3164 timestamp does not equal expected, ts=%s, converted=%s, expected=%s", ts, converted, expected); \
++ cr_expect(_rfc3164_timestamp_eq(ts, -1, expected, converted), "Parsed RFC3164 timestamp does not equal expected, ts=%s, converted=%s, expected=%s", ts, converted, expected); \
++ })
++
++#define _expect_rfc3164_timestamp_len_eq(ts, len, expected) \
++ ({ \
++ gchar converted[32]; \
++ cr_expect(_rfc3164_timestamp_eq(ts, len, expected, converted), "Parsed RFC3164 timestamp does not equal expected, ts=%s, converted=%s, expected=%s", ts, converted, expected); \
++ })
++
++#define _expect_rfc3164_fails(ts, len) \
++ ({ \
++ WallClockTime wct = WALL_CLOCK_TIME_INIT; \
++ const guchar *data = (guchar *) ts; \
++ gint length = len < 0 ? strlen(ts) : len; \
++ cr_assert_not(scan_rfc3164_timestamp(&data, &length, &wct)); \
+ })
+
+ #define _expect_rfc5424_timestamp_eq(ts, expected) \
+ ({ \
+ gchar converted[32]; \
+- cr_expect(_rfc5424_timestamp_eq(ts, expected, converted), "Parsed RFC5424 timestamp does not equal expected, ts=%s, converted=%s, expected=%s", ts, converted, expected); \
++ cr_expect(_rfc5424_timestamp_eq(ts, -1, expected, converted), "Parsed RFC5424 timestamp does not equal expected, ts=%s, converted=%s, expected=%s", ts, converted, expected); \
++ })
++
++#define _expect_rfc5424_timestamp_len_eq(ts, len, expected) \
++ ({ \
++ gchar converted[32]; \
++ cr_expect(_rfc5424_timestamp_eq(ts, len, expected, converted), "Parsed RFC5424 timestamp does not equal expected, ts=%s, converted=%s, expected=%s", ts, converted, expected); \
++ })
++
++#define _expect_rfc5424_fails(ts, len) \
++ ({ \
++ WallClockTime wct = WALL_CLOCK_TIME_INIT; \
++ const guchar *data = (guchar *) ts; \
++ gint length = len < 0 ? strlen(ts) : len; \
++ cr_assert_not(scan_rfc5424_timestamp(&data, &length, &wct)); \
+ })
+
++
+ Test(parse_timestamp, standard_bsd_format)
+ {
+ _expect_rfc3164_timestamp_eq("Oct 1 17:46:12", "2017-10-01T17:46:12.000+02:00");
+@@ -164,6 +202,68 @@ Test(parse_timestamp, standard_bsd_format_year_in_the_past)
+ _expect_rfc3164_timestamp_eq("Dec 31 17:46:12", "2017-12-31T17:46:12.000+01:00");
+ }
+
++Test(parse_timestamp, non_zero_terminated_rfc3164_iso_input_is_handled_properly)
++{
++ gchar *ts = "2022-08-17T05:02:28.417Z whatever";
++ gint ts_len = 24;
++
++ _expect_rfc3164_timestamp_len_eq(ts, strlen(ts), "2022-08-17T05:02:28.417+00:00");
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len + 5, "2022-08-17T05:02:28.417+00:00");
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len, "2022-08-17T05:02:28.417+00:00");
++
++ /* no "Z" parsed, timezone defaults to local, forced CET */
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len - 1, "2022-08-17T05:02:28.417+02:00");
++
++ /* msec is partially parsed as we trim the string from the right */
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len - 2, "2022-08-17T05:02:28.410+02:00");
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len - 3, "2022-08-17T05:02:28.400+02:00");
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len - 4, "2022-08-17T05:02:28.000+02:00");
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len - 5, "2022-08-17T05:02:28.000+02:00");
++
++ for (gint i = 6; i < ts_len; i++)
++ _expect_rfc3164_fails(ts, ts_len - i);
++
++}
++
++Test(parse_timestamp, non_zero_terminated_rfc3164_bsd_pix_or_asa_input_is_handled_properly)
++{
++ gchar *ts = "Aug 17 2022 05:02:28: whatever";
++ gint ts_len = 21;
++
++ _expect_rfc3164_timestamp_len_eq(ts, strlen(ts), "2022-08-17T05:02:28.000+02:00");
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len + 5, "2022-08-17T05:02:28.000+02:00");
++ _expect_rfc3164_timestamp_len_eq(ts, ts_len, "2022-08-17T05:02:28.000+02:00");
++
++ /* no ":" at the end, that's a problem, unrecognized */
++ _expect_rfc3164_fails(ts, ts_len - 1);
++
++ for (gint i = 1; i < ts_len; i++)
++ _expect_rfc3164_fails(ts, ts_len - i);
++}
++
++Test(parse_timestamp, non_zero_terminated_rfc5424_input_is_handled_properly)
++{
++ gchar *ts = "2022-08-17T05:02:28.417Z whatever";
++ gint ts_len = 24;
++
++ _expect_rfc5424_timestamp_len_eq(ts, strlen(ts), "2022-08-17T05:02:28.417+00:00");
++ _expect_rfc5424_timestamp_len_eq(ts, ts_len + 5, "2022-08-17T05:02:28.417+00:00");
++ _expect_rfc5424_timestamp_len_eq(ts, ts_len, "2022-08-17T05:02:28.417+00:00");
++
++ /* no "Z" parsed, timezone defaults to local, forced CET */
++ _expect_rfc5424_timestamp_len_eq(ts, ts_len - 1, "2022-08-17T05:02:28.417+02:00");
++
++ /* msec is partially parsed as we trim the string from the right */
++ _expect_rfc5424_timestamp_len_eq(ts, ts_len - 2, "2022-08-17T05:02:28.410+02:00");
++ _expect_rfc5424_timestamp_len_eq(ts, ts_len - 3, "2022-08-17T05:02:28.400+02:00");
++ _expect_rfc5424_timestamp_len_eq(ts, ts_len - 4, "2022-08-17T05:02:28.000+02:00");
++ _expect_rfc5424_timestamp_len_eq(ts, ts_len - 5, "2022-08-17T05:02:28.000+02:00");
++
++ for (gint i = 6; i < ts_len; i++)
++ _expect_rfc5424_fails(ts, ts_len - i);
++
++}
++
+
+ Test(parse_timestamp, daylight_saving_behavior_at_spring_with_explicit_timezones)
+ {
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0006.patch b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0006.patch
new file mode 100644
index 0000000000..81e36c6501
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0006.patch
@@ -0,0 +1,180 @@
+From 09f489c89c826293ff8cbd282cfc866ab56054c4 Mon Sep 17 00:00:00 2001
+From: Laszlo Varady <laszlo.varady@protonmail.com>
+Date: Sat, 20 Aug 2022 14:29:43 +0200
+Subject: [PATCH 6/8] timeutils: name repeating constant
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CVE: CVE-2022-38725
+
+Upstream-Status: Backport
+[https://github.com/syslog-ng/syslog-ng/commit/09f489c89c826293ff8cbd282cfc866ab56054c4]
+
+Signed-off-by: László Várady <laszlo.varady@protonmail.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ lib/timeutils/scan-timestamp.c | 54 ++++++++++++++++++----------------
+ 1 file changed, 29 insertions(+), 25 deletions(-)
+
+diff --git a/lib/timeutils/scan-timestamp.c b/lib/timeutils/scan-timestamp.c
+index 4fbe94a36..d22d50973 100644
+--- a/lib/timeutils/scan-timestamp.c
++++ b/lib/timeutils/scan-timestamp.c
+@@ -34,41 +34,43 @@ scan_day_abbrev(const gchar **buf, gint *left, gint *wday)
+ {
+ *wday = -1;
+
+- if (*left < 3)
++ const gsize abbrev_length = 3;
++
++ if (*left < abbrev_length)
+ return FALSE;
+
+ switch (**buf)
+ {
+ case 'S':
+- if (strncasecmp(*buf, "Sun", 3) == 0)
++ if (strncasecmp(*buf, "Sun", abbrev_length) == 0)
+ *wday = 0;
+- else if (strncasecmp(*buf, "Sat", 3) == 0)
++ else if (strncasecmp(*buf, "Sat", abbrev_length) == 0)
+ *wday = 6;
+ else
+ return FALSE;
+ break;
+ case 'M':
+- if (strncasecmp(*buf, "Mon", 3) == 0)
++ if (strncasecmp(*buf, "Mon", abbrev_length) == 0)
+ *wday = 1;
+ else
+ return FALSE;
+ break;
+ case 'T':
+- if (strncasecmp(*buf, "Tue", 3) == 0)
++ if (strncasecmp(*buf, "Tue", abbrev_length) == 0)
+ *wday = 2;
+- else if (strncasecmp(*buf, "Thu", 3) == 0)
++ else if (strncasecmp(*buf, "Thu", abbrev_length) == 0)
+ *wday = 4;
+ else
+ return FALSE;
+ break;
+ case 'W':
+- if (strncasecmp(*buf, "Wed", 3) == 0)
++ if (strncasecmp(*buf, "Wed", abbrev_length) == 0)
+ *wday = 3;
+ else
+ return FALSE;
+ break;
+ case 'F':
+- if (strncasecmp(*buf, "Fri", 3) == 0)
++ if (strncasecmp(*buf, "Fri", abbrev_length) == 0)
+ *wday = 5;
+ else
+ return FALSE;
+@@ -77,8 +79,8 @@ scan_day_abbrev(const gchar **buf, gint *left, gint *wday)
+ return FALSE;
+ }
+
+- (*buf) += 3;
+- (*left) -= 3;
++ (*buf) += abbrev_length;
++ (*left) -= abbrev_length;
+ return TRUE;
+ }
+
+@@ -87,63 +89,65 @@ scan_month_abbrev(const gchar **buf, gint *left, gint *mon)
+ {
+ *mon = -1;
+
+- if (*left < 3)
++ const gsize abbrev_length = 3;
++
++ if (*left < abbrev_length)
+ return FALSE;
+
+ switch (**buf)
+ {
+ case 'J':
+- if (strncasecmp(*buf, "Jan", 3) == 0)
++ if (strncasecmp(*buf, "Jan", abbrev_length) == 0)
+ *mon = 0;
+- else if (strncasecmp(*buf, "Jun", 3) == 0)
++ else if (strncasecmp(*buf, "Jun", abbrev_length) == 0)
+ *mon = 5;
+- else if (strncasecmp(*buf, "Jul", 3) == 0)
++ else if (strncasecmp(*buf, "Jul", abbrev_length) == 0)
+ *mon = 6;
+ else
+ return FALSE;
+ break;
+ case 'F':
+- if (strncasecmp(*buf, "Feb", 3) == 0)
++ if (strncasecmp(*buf, "Feb", abbrev_length) == 0)
+ *mon = 1;
+ else
+ return FALSE;
+ break;
+ case 'M':
+- if (strncasecmp(*buf, "Mar", 3) == 0)
++ if (strncasecmp(*buf, "Mar", abbrev_length) == 0)
+ *mon = 2;
+- else if (strncasecmp(*buf, "May", 3) == 0)
++ else if (strncasecmp(*buf, "May", abbrev_length) == 0)
+ *mon = 4;
+ else
+ return FALSE;
+ break;
+ case 'A':
+- if (strncasecmp(*buf, "Apr", 3) == 0)
++ if (strncasecmp(*buf, "Apr", abbrev_length) == 0)
+ *mon = 3;
+- else if (strncasecmp(*buf, "Aug", 3) == 0)
++ else if (strncasecmp(*buf, "Aug", abbrev_length) == 0)
+ *mon = 7;
+ else
+ return FALSE;
+ break;
+ case 'S':
+- if (strncasecmp(*buf, "Sep", 3) == 0)
++ if (strncasecmp(*buf, "Sep", abbrev_length) == 0)
+ *mon = 8;
+ else
+ return FALSE;
+ break;
+ case 'O':
+- if (strncasecmp(*buf, "Oct", 3) == 0)
++ if (strncasecmp(*buf, "Oct", abbrev_length) == 0)
+ *mon = 9;
+ else
+ return FALSE;
+ break;
+ case 'N':
+- if (strncasecmp(*buf, "Nov", 3) == 0)
++ if (strncasecmp(*buf, "Nov", abbrev_length) == 0)
+ *mon = 10;
+ else
+ return FALSE;
+ break;
+ case 'D':
+- if (strncasecmp(*buf, "Dec", 3) == 0)
++ if (strncasecmp(*buf, "Dec", abbrev_length) == 0)
+ *mon = 11;
+ else
+ return FALSE;
+@@ -152,8 +156,8 @@ scan_month_abbrev(const gchar **buf, gint *left, gint *mon)
+ return FALSE;
+ }
+
+- (*buf) += 3;
+- (*left) -= 3;
++ (*buf) += abbrev_length;
++ (*left) -= abbrev_length;
+ return TRUE;
+ }
+
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0007.patch b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0007.patch
new file mode 100644
index 0000000000..abb36fdf5f
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0007.patch
@@ -0,0 +1,81 @@
+From 8c6e2c1c41b0fcc5fbd464c35f4dac7102235396 Mon Sep 17 00:00:00 2001
+From: Laszlo Varady <laszlo.varady@protonmail.com>
+Date: Sat, 20 Aug 2022 14:30:22 +0200
+Subject: [PATCH 7/8] timeutils: fix invalid calculation of ISO timestamp length
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CVE: CVE-2022-38725
+
+Upstream-Status: Backport
+[https://github.com/syslog-ng/syslog-ng/commit/8c6e2c1c41b0fcc5fbd464c35f4dac7102235396]
+
+Signed-off-by: László Várady <laszlo.varady@protonmail.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ lib/timeutils/scan-timestamp.c | 8 ++++++--
+ lib/timeutils/tests/test_scan-timestamp.c | 7 +++++++
+ 2 files changed, 13 insertions(+), 2 deletions(-)
+
+diff --git a/lib/timeutils/scan-timestamp.c b/lib/timeutils/scan-timestamp.c
+index d22d50973..125264677 100644
+--- a/lib/timeutils/scan-timestamp.c
++++ b/lib/timeutils/scan-timestamp.c
+@@ -350,19 +350,21 @@ __parse_usec(const guchar **data, gint *length)
+ static gboolean
+ __has_iso_timezone(const guchar *src, gint length)
+ {
+- return (length >= 5) &&
++ return (length >= 6) &&
+ (*src == '+' || *src == '-') &&
+ isdigit(*(src+1)) &&
+ isdigit(*(src+2)) &&
+ *(src+3) == ':' &&
+ isdigit(*(src+4)) &&
+ isdigit(*(src+5)) &&
+- !isdigit(*(src+6));
++ (length < 7 || !isdigit(*(src+6)));
+ }
+
+ static guint32
+ __parse_iso_timezone(const guchar **data, gint *length)
+ {
++ g_assert(*length >= 6);
++
+ gint hours, mins;
+ const guchar *src = *data;
+ guint32 tz = 0;
+@@ -372,8 +374,10 @@ __parse_iso_timezone(const guchar **data, gint *length)
+ hours = (*(src + 1) - '0') * 10 + *(src + 2) - '0';
+ mins = (*(src + 4) - '0') * 10 + *(src + 5) - '0';
+ tz = sign * (hours * 3600 + mins * 60);
++
+ src += 6;
+ (*length) -= 6;
++
+ *data = src;
+ return tz;
+ }
+diff --git a/lib/timeutils/tests/test_scan-timestamp.c b/lib/timeutils/tests/test_scan-timestamp.c
+index 468bbf779..d18bdc65d 100644
+--- a/lib/timeutils/tests/test_scan-timestamp.c
++++ b/lib/timeutils/tests/test_scan-timestamp.c
+@@ -264,6 +264,13 @@ Test(parse_timestamp, non_zero_terminated_rfc5424_input_is_handled_properly)
+
+ }
+
++Test(parse_timestamp, non_zero_terminated_rfc5424_timestamp_only)
++{
++ const gchar *ts = "2022-08-17T05:02:28.417+03:00";
++ gint ts_len = strlen(ts);
++ _expect_rfc5424_timestamp_len_eq(ts, ts_len, ts);
++}
++
+
+ Test(parse_timestamp, daylight_saving_behavior_at_spring_with_explicit_timezones)
+ {
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0008.patch b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0008.patch
new file mode 100644
index 0000000000..56c71e8a21
--- /dev/null
+++ b/meta-oe/recipes-support/syslog-ng/files/CVE-2022-38725-0008.patch
@@ -0,0 +1,45 @@
+From 56f881c5eaa3d8c02c96607c4b9e4eaf959a044d Mon Sep 17 00:00:00 2001
+From: Laszlo Varady <laszlo.varady@protonmail.com>
+Date: Sat, 20 Aug 2022 14:30:51 +0200
+Subject: [PATCH 8/8/] timeutils: fix out-of-bounds reading of data buffer
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CVE: CVE-2022-38725
+
+Upstream-Status: Backport
+[https://github.com/syslog-ng/syslog-ng/commit/56f881c5eaa3d8c02c96607c4b9e4eaf959a044d]
+
+Signed-off-by: László Várady <laszlo.varady@protonmail.com>
+
+Signed-off-by: Yogita Urade <yogita.urade@windriver.com>
+---
+ lib/timeutils/scan-timestamp.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/lib/timeutils/scan-timestamp.c b/lib/timeutils/scan-timestamp.c
+index 125264677..c00d8e6a9 100644
+--- a/lib/timeutils/scan-timestamp.c
++++ b/lib/timeutils/scan-timestamp.c
+@@ -431,7 +431,7 @@ __parse_bsd_timestamp(const guchar **data, gint *length, WallClockTime *wct)
+ if (!scan_pix_timestamp((const gchar **) &src, &left, wct))
+ return FALSE;
+
+- if (*src == ':')
++ if (left && *src == ':')
+ {
+ src++;
+ left--;
+@@ -482,7 +482,7 @@ scan_rfc3164_timestamp(const guchar **data, gint *length, WallClockTime *wct)
+ * looking at you, skip that as well, so we can reliably detect IPv6
+ * addresses as hostnames, which would be using ":" as well. */
+
+- if (*src == ':')
++ if (left && *src == ':')
+ {
+ ++src;
+ --left;
+--
+2.34.1
+
diff --git a/meta-oe/recipes-support/syslog-ng/syslog-ng_3.36.1.bb b/meta-oe/recipes-support/syslog-ng/syslog-ng_3.36.1.bb
index 40bbfe495a..045b9b71c9 100644
--- a/meta-oe/recipes-support/syslog-ng/syslog-ng_3.36.1.bb
+++ b/meta-oe/recipes-support/syslog-ng/syslog-ng_3.36.1.bb
@@ -22,6 +22,14 @@ SRC_URI = "https://github.com/balabit/syslog-ng/releases/download/${BP}/${BP}.ta
file://volatiles.03_syslog-ng \
file://syslog-ng-tmp.conf \
file://syslog-ng.service-the-syslog-ng-service.patch \
+ file://CVE-2022-38725-0001.patch \
+ file://CVE-2022-38725-0002.patch \
+ file://CVE-2022-38725-0003.patch \
+ file://CVE-2022-38725-0004.patch \
+ file://CVE-2022-38725-0005.patch \
+ file://CVE-2022-38725-0006.patch \
+ file://CVE-2022-38725-0007.patch \
+ file://CVE-2022-38725-0008.patch \
"
SRC_URI[sha256sum] = "90a25c9767fe749db50f118ddfc92ec71399763d2ecd5ad4f11ff5eea049e60b"
diff --git a/meta-oe/recipes-support/unixodbc/files/CVE-2024-1013.patch b/meta-oe/recipes-support/unixodbc/files/CVE-2024-1013.patch
new file mode 100644
index 0000000000..7d37ad6042
--- /dev/null
+++ b/meta-oe/recipes-support/unixodbc/files/CVE-2024-1013.patch
@@ -0,0 +1,53 @@
+From 45f501e1be2db6b017cc242c79bfb9de32b332a1 Mon Sep 17 00:00:00 2001
+From: Florian Weimer <fweimer@redhat.com>
+Date: Mon, 29 Jan 2024 08:27:29 +0100
+Subject: [PATCH] PostgreSQL driver: Fix incompatible pointer-to-integer types
+
+These result in out-of-bounds stack writes on 64-bit architectures
+(caller has 4 bytes, callee writes 8 bytes), and seem to have gone
+unnoticed on little-endian architectures (although big-endian
+architectures must be broken).
+
+This change is required to avoid a build failure with GCC 14.
+
+CVE: CVE-2024-1013
+
+Upstream-Status: Backport [https://github.com/lurcher/unixODBC/commit/45f501e1be2db6b017cc242c79bfb9de32b332a1]
+
+Signed-off-by: Soumya Sambu <soumya.sambu@windriver.com>
+---
+ Drivers/Postgre7.1/info.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/Drivers/Postgre7.1/info.c b/Drivers/Postgre7.1/info.c
+index 63ac91f..2216ecd 100755
+--- a/Drivers/Postgre7.1/info.c
++++ b/Drivers/Postgre7.1/info.c
+@@ -1779,14 +1779,14 @@ char *table_name;
+ char index_name[MAX_INFO_STRING];
+ short fields_vector[8];
+ char isunique[10], isclustered[10];
+-SDWORD index_name_len, fields_vector_len;
++SQLLEN index_name_len, fields_vector_len;
+ TupleNode *row;
+ int i;
+ HSTMT hcol_stmt;
+ StatementClass *col_stmt, *indx_stmt;
+ char column_name[MAX_INFO_STRING], relhasrules[MAX_INFO_STRING];
+ char **column_names = 0;
+-Int4 column_name_len;
++SQLLEN column_name_len;
+ int total_columns = 0;
+ char error = TRUE;
+ ConnInfo *ci;
+@@ -2136,7 +2136,7 @@ HSTMT htbl_stmt;
+ StatementClass *tbl_stmt;
+ char tables_query[STD_STATEMENT_LEN];
+ char attname[MAX_INFO_STRING];
+-SDWORD attname_len;
++SQLLEN attname_len;
+ char pktab[MAX_TABLE_LEN + 1];
+ Int2 result_cols;
+
+--
+2.40.0
diff --git a/meta-oe/recipes-support/unixodbc/unixodbc_2.3.9.bb b/meta-oe/recipes-support/unixodbc/unixodbc_2.3.9.bb
index c194739cb1..283546cf0e 100644
--- a/meta-oe/recipes-support/unixodbc/unixodbc_2.3.9.bb
+++ b/meta-oe/recipes-support/unixodbc/unixodbc_2.3.9.bb
@@ -10,6 +10,7 @@ DEPENDS = "libtool readline"
SRC_URI = "http://ftp.unixodbc.org/unixODBC-${PV}.tar.gz \
file://do-not-use-libltdl-source-directory.patch \
+ file://CVE-2024-1013.patch \
"
SRC_URI[sha256sum] = "52833eac3d681c8b0c9a5a65f2ebd745b3a964f208fc748f977e44015a31b207"
diff --git a/meta-oe/recipes-support/uriparser/uriparser_0.9.6.bb b/meta-oe/recipes-support/uriparser/uriparser_0.9.8.bb
index 0d45a15595..bfe191a6c4 100644
--- a/meta-oe/recipes-support/uriparser/uriparser_0.9.6.bb
+++ b/meta-oe/recipes-support/uriparser/uriparser_0.9.8.bb
@@ -5,7 +5,7 @@ LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://COPYING;md5=fcc5a53146c2401f4b4f6a3bdf3f0168"
SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/${BP}/${BP}.tar.gz"
-SRC_URI[sha256sum] = "10e6f90d359c1087c45f907f95e527a8aca84422251081d1533231e031a084ff"
+SRC_URI[sha256sum] = "4cd0e4f93b477272fabceeb0202f269169fe6ec3044e10fac6acbcdf354bb080"
UPSTREAM_CHECK_URI = "https://github.com/${BPN}/${BPN}/releases"
diff --git a/meta-oe/recipes-support/yaml-cpp/yaml-cpp/0001-Fix-CMake-export-files-1077.patch b/meta-oe/recipes-support/yaml-cpp/yaml-cpp/0001-Fix-CMake-export-files-1077.patch
new file mode 100644
index 0000000000..b6c4a3b883
--- /dev/null
+++ b/meta-oe/recipes-support/yaml-cpp/yaml-cpp/0001-Fix-CMake-export-files-1077.patch
@@ -0,0 +1,117 @@
+From 3d436f6cfc2dfe52fc1533c01f57c25ae7ffac9c Mon Sep 17 00:00:00 2001
+From: Felix Schwitzer <flx107809@gmail.com>
+Date: Fri, 1 Apr 2022 05:26:47 +0200
+Subject: [PATCH] Fix CMake export files (#1077)
+
+After configuring the file `yaml-cpp-config.cmake.in`, the result ends up with
+empty variables. (see also the discussion in #774).
+
+Rework this file and the call to `configure_package_config_file` according the
+cmake documentation
+(https://cmake.org/cmake/help/v3.22/module/CMakePackageConfigHelpers.html?highlight=configure_package_config#command:configure_package_config_file)
+to overcome this issue and allow a simple `find_package` after install.
+
+As there was some discussion about the place where to install the
+`yaml-cpp-config.cmake` file, e.g. #1055, factor out the install location into
+an extra variable to make it easier changing this location in the future.
+
+Also untabify CMakeLists.txt in some places to align with the other code parts in this file.
+
+Upstream-Status: Accepted [https://github.com/jbeder/yaml-cpp/pull/1077]
+
+Signed-off-by: Jasper Orschulko <jasper@fancydomain.eu>
+---
+ CMakeLists.txt | 29 ++++++++++++++++++-----------
+ yaml-cpp-config.cmake.in | 10 ++++++----
+ 2 files changed, 24 insertions(+), 15 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index b230b9e..983d1a4 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -127,10 +127,16 @@ set_target_properties(yaml-cpp PROPERTIES
+ PROJECT_LABEL "yaml-cpp ${yaml-cpp-label-postfix}"
+ DEBUG_POSTFIX "${CMAKE_DEBUG_POSTFIX}")
+
++# FIXME(felix2012): A more common place for the cmake export would be
++# `CMAKE_INSTALL_LIBDIR`, as e.g. done in ubuntu or in this project for GTest
++set(CONFIG_EXPORT_DIR "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
++set(EXPORT_TARGETS yaml-cpp)
+ configure_package_config_file(
+ "${PROJECT_SOURCE_DIR}/yaml-cpp-config.cmake.in"
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
+- INSTALL_DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
++ INSTALL_DESTINATION "${CONFIG_EXPORT_DIR}"
++ PATH_VARS CMAKE_INSTALL_INCLUDEDIR CONFIG_EXPORT_DIR)
++unset(EXPORT_TARGETS)
+
+ write_basic_package_version_file(
+ "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
+@@ -139,30 +145,31 @@ write_basic_package_version_file(
+ configure_file(yaml-cpp.pc.in yaml-cpp.pc @ONLY)
+
+ if (YAML_CPP_INSTALL)
+- install(TARGETS yaml-cpp
++ install(TARGETS yaml-cpp
+ EXPORT yaml-cpp-targets
+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
+- install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
++ install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/
+ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
+- FILES_MATCHING PATTERN "*.h")
++ FILES_MATCHING PATTERN "*.h")
+ install(EXPORT yaml-cpp-targets
+- DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
+- install(FILES
+- "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
+- "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
+- DESTINATION "${CMAKE_INSTALL_DATADIR}/cmake/yaml-cpp")
++ DESTINATION "${CONFIG_EXPORT_DIR}")
++ install(FILES
++ "${PROJECT_BINARY_DIR}/yaml-cpp-config.cmake"
++ "${PROJECT_BINARY_DIR}/yaml-cpp-config-version.cmake"
++ DESTINATION "${CONFIG_EXPORT_DIR}")
+ install(FILES "${PROJECT_BINARY_DIR}/yaml-cpp.pc"
+ DESTINATION ${CMAKE_INSTALL_DATADIR}/pkgconfig)
+ endif()
++unset(CONFIG_EXPORT_DIR)
+
+ if(YAML_CPP_BUILD_TESTS)
+- add_subdirectory(test)
++ add_subdirectory(test)
+ endif()
+
+ if(YAML_CPP_BUILD_TOOLS)
+- add_subdirectory(util)
++ add_subdirectory(util)
+ endif()
+
+ if (YAML_CPP_CLANG_FORMAT_EXE)
+diff --git a/yaml-cpp-config.cmake.in b/yaml-cpp-config.cmake.in
+index 7b41e3f..a7ace3d 100644
+--- a/yaml-cpp-config.cmake.in
++++ b/yaml-cpp-config.cmake.in
+@@ -3,12 +3,14 @@
+ # YAML_CPP_INCLUDE_DIR - include directory
+ # YAML_CPP_LIBRARIES - libraries to link against
+
+-# Compute paths
+-get_filename_component(YAML_CPP_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
+-set(YAML_CPP_INCLUDE_DIR "@CONFIG_INCLUDE_DIRS@")
++@PACKAGE_INIT@
++
++set_and_check(YAML_CPP_INCLUDE_DIR "@PACKAGE_CMAKE_INSTALL_INCLUDEDIR@")
+
+ # Our library dependencies (contains definitions for IMPORTED targets)
+-include("${YAML_CPP_CMAKE_DIR}/yaml-cpp-targets.cmake")
++include(@PACKAGE_CONFIG_EXPORT_DIR@/yaml-cpp-targets.cmake)
+
+ # These are IMPORTED targets created by yaml-cpp-targets.cmake
+ set(YAML_CPP_LIBRARIES "@EXPORT_TARGETS@")
++
++check_required_components(@EXPORT_TARGETS@)
+--
+2.39.2
+
diff --git a/meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb b/meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb
index d3984abe8b..e04d4705a4 100644
--- a/meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb
+++ b/meta-oe/recipes-support/yaml-cpp/yaml-cpp_0.7.0.bb
@@ -8,6 +8,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=6a8aaf0595c2efc1a9c2e0913e9c1a2c"
# yaml-cpp releases are stored as archive files in github.
# download the exact revision of release
SRC_URI = "git://github.com/jbeder/yaml-cpp.git;branch=master;protocol=https"
+SRC_URI += "file://0001-Fix-CMake-export-files-1077.patch"
SRCREV = "0579ae3d976091d7d664aa9d2527e0d0cff25763"
S = "${WORKDIR}/git"