aboutsummaryrefslogtreecommitdiffstats
path: root/main/gnutls/CVE-2021-20231.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2021-03-24 12:41:25 +0100
committerNatanael Copa <ncopa@alpinelinux.org>2021-03-24 12:44:31 +0100
commit696ea45aea1f48e8a177df39dfc174b609bea9a7 (patch)
tree0ab9a36a3893ab39fef7bbcb5d0bd4a7afd13215 /main/gnutls/CVE-2021-20231.patch
parent4cfa2e8f54197c9f469cffca9519864f04f7b9db (diff)
downloadaports-696ea45aea1f48e8a177df39dfc174b609bea9a7.tar.gz
aports-696ea45aea1f48e8a177df39dfc174b609bea9a7.tar.bz2
aports-696ea45aea1f48e8a177df39dfc174b609bea9a7.tar.xz
main/gnutls: fix CVE-2021-20231 and CVE-2021-20232
fixes #12543
Diffstat (limited to 'main/gnutls/CVE-2021-20231.patch')
-rw-r--r--main/gnutls/CVE-2021-20231.patch62
1 files changed, 62 insertions, 0 deletions
diff --git a/main/gnutls/CVE-2021-20231.patch b/main/gnutls/CVE-2021-20231.patch
new file mode 100644
index 0000000000..3601446794
--- /dev/null
+++ b/main/gnutls/CVE-2021-20231.patch
@@ -0,0 +1,62 @@
+From 15beb4b193b2714d88107e7dffca781798684e7e Mon Sep 17 00:00:00 2001
+From: Daiki Ueno <ueno@gnu.org>
+Date: Fri, 29 Jan 2021 14:06:32 +0100
+Subject: [PATCH] key_share: avoid use-after-free around realloc
+
+Signed-off-by: Daiki Ueno <ueno@gnu.org>
+---
+ lib/ext/key_share.c | 12 +++++-------
+ 1 file changed, 5 insertions(+), 7 deletions(-)
+
+diff --git a/lib/ext/key_share.c b/lib/ext/key_share.c
+index ab8abf8fe6..a8c4bb5cff 100644
+--- a/lib/ext/key_share.c
++++ b/lib/ext/key_share.c
+@@ -664,14 +664,14 @@ key_share_send_params(gnutls_session_t session,
+ {
+ unsigned i;
+ int ret;
+- unsigned char *lengthp;
+- unsigned int cur_length;
+ unsigned int generated = 0;
+ const gnutls_group_entry_st *group;
+ const version_entry_st *ver;
+
+ /* this extension is only being sent on client side */
+ if (session->security_parameters.entity == GNUTLS_CLIENT) {
++ unsigned int length_pos;
++
+ ver = _gnutls_version_max(session);
+ if (unlikely(ver == NULL || ver->key_shares == 0))
+ return 0;
+@@ -679,16 +679,13 @@ key_share_send_params(gnutls_session_t session,
+ if (!have_creds_for_tls13(session))
+ return 0;
+
+- /* write the total length later */
+- lengthp = &extdata->data[extdata->length];
++ length_pos = extdata->length;
+
+ ret =
+ _gnutls_buffer_append_prefix(extdata, 16, 0);
+ if (ret < 0)
+ return gnutls_assert_val(ret);
+
+- cur_length = extdata->length;
+-
+ if (session->internals.hsk_flags & HSK_HRR_RECEIVED) { /* we know the group */
+ group = get_group(session);
+ if (unlikely(group == NULL))
+@@ -736,7 +733,8 @@ key_share_send_params(gnutls_session_t session,
+ }
+
+ /* copy actual length */
+- _gnutls_write_uint16(extdata->length - cur_length, lengthp);
++ _gnutls_write_uint16(extdata->length - length_pos - 2,
++ &extdata->data[length_pos]);
+
+ } else { /* server */
+ ver = get_version(session);
+--
+GitLab
+