summaryrefslogtreecommitdiffstats
path: root/meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch')
-rw-r--r--meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch b/meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch
new file mode 100644
index 0000000000..0bcb55e573
--- /dev/null
+++ b/meta/recipes-support/gnutls/gnutls/CVE-2021-4209.patch
@@ -0,0 +1,37 @@
1From 3db352734472d851318944db13be73da61300568 Mon Sep 17 00:00:00 2001
2From: Daiki Ueno <ueno@gnu.org>
3Date: Wed, 22 Dec 2021 09:12:25 +0100
4Subject: [PATCH] wrap_nettle_hash_fast: avoid calling _update with zero-length
5 input
6
7As Nettle's hash update functions internally call memcpy, providing
8zero-length input may cause undefined behavior.
9
10Signed-off-by: Daiki Ueno <ueno@gnu.org>
11
12https://gitlab.com/gnutls/gnutls/-/commit/3db352734472d851318944db13be73da61300568
13Upstream-Status: Backport
14CVE: CVE-2021-4209
15Signed-off-by: Chee Yang Lee <chee.yang.lee@intel.com>
16---
17 lib/nettle/mac.c | 4 +++-
18 1 file changed, 3 insertions(+), 1 deletion(-)
19
20diff --git a/lib/nettle/mac.c b/lib/nettle/mac.c
21index f9d4d7a8df..35e070fab0 100644
22--- a/lib/nettle/mac.c
23+++ b/lib/nettle/mac.c
24@@ -788,7 +788,9 @@ static int wrap_nettle_hash_fast(gnutls_digest_algorithm_t algo,
25 if (ret < 0)
26 return gnutls_assert_val(ret);
27
28- ctx.update(&ctx, text_size, text);
29+ if (text_size > 0) {
30+ ctx.update(&ctx, text_size, text);
31+ }
32 ctx.digest(&ctx, ctx.length, digest);
33
34 return 0;
35--
36GitLab
37