[packages/libksba] Rel 2. Backport DN UCS-2/UCS-4 and OCSP double free fixes
arekm
arekm at pld-linux.org
Thu Oct 29 08:41:49 CET 2026
commit 7373cd025e05879e41668105a0fcaedefaa0b3ea
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Thu Oct 29 00:07:04 2026 +0100
Rel 2. Backport DN UCS-2/UCS-4 and OCSP double free fixes
libksba-dn-ucs-oob.patch | 85 ++++++++++++++++++++++++++++++++++++++++++
libksba-ocsp-double-free.patch | 43 +++++++++++++++++++++
libksba.spec | 12 ++++--
3 files changed, 137 insertions(+), 3 deletions(-)
---
diff --git a/libksba.spec b/libksba.spec
index 44c1869..912b437 100644
--- a/libksba.spec
+++ b/libksba.spec
@@ -8,12 +8,16 @@ Summary(pl.UTF-8): KSBA = rot13(digit_to_letter(x509)), wymawiane "kasba"
Summary(pt_BR.UTF-8): KSBA = rot13(digit_to_letter(x509)) pronunciado como Kasbah
Name: libksba
Version: 1.8.1
-Release: 1
+Release: 2
License: LGPL v3+ or GPL v2+ (libraries), GPL v3+ (the rest)
Group: Libraries
Source0: https://www.gnupg.org/ftp/gcrypt/libksba/%{name}-%{version}.tar.bz2
# Source0-md5: 43db411cfce028d1300113a4c3b30c54
Patch0: %{name}-info.patch
+# https://github.com/gpg/libksba/commit/7946bf2a12eb87027e867cec667caaff6ecb701d
+Patch1: %{name}-dn-ucs-oob.patch
+# https://github.com/gpg/libksba/commit/c5dc198f571c26b70a6443ac9a2809d4eea16df2
+Patch2: %{name}-ocsp-double-free.patch
URL: https://www.gnupg.org/related_software/libksba/
BuildRequires: autoconf >= 2.69
BuildRequires: autoconf-archive
@@ -44,7 +48,7 @@ Summary(pl.UTF-8): Pliki nagłówkowe do tworzenia programów używających KSBA
Summary(pt_BR.UTF-8): Arquivos de desenvolvimento da KSBA
License: LGPL v3+ or GPL v2+ (libraries), GPL v3+ (manual)
Group: Development/Libraries
-Requires: %{name} = %{version}-%{release}
+Requires: %{name}%{?_isa} = %{version}-%{release}
Requires: libgpg-error-devel >= 1.46
%description devel
@@ -63,7 +67,7 @@ Summary(pl.UTF-8): Biblioteki statyczne KSBA
Summary(pt_BR.UTF-8): Arquivos de desenvolvimento da KSBA - biblioteca estática
License: LGPL v3+ or GPL v2+
Group: Development/Libraries
-Requires: %{name}-devel = %{version}-%{release}
+Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description static
Static KSBA libraries.
@@ -77,6 +81,8 @@ Bibliotecas de desenvolvimento para KSBA - estático.
%prep
%setup -q
%patch -P0 -p1
+%patch -P1 -p1
+%patch -P2 -p1
%build
%{__libtoolize}
diff --git a/libksba-dn-ucs-oob.patch b/libksba-dn-ucs-oob.patch
new file mode 100644
index 0000000..766e3a8
--- /dev/null
+++ b/libksba-dn-ucs-oob.patch
@@ -0,0 +1,85 @@
+Out-of-bounds read on truncated UCS-2/UCS-4 DN attribute values (GnuPG T8476).
+https://github.com/gpg/libksba/commit/7946bf2a12eb87027e867cec667caaff6ecb701d
+https://github.com/gpg/libksba/commit/4561696808f864fd396d6401d8779d31b0bcf6c1
+
+From 7946bf2a12eb87027e867cec667caaff6ecb701d Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe at fsij.org>
+Date: Tue, 6 Oct 2026 10:46:20 +0900
+Subject: [PATCH] Fix attribute to string OOB for UCS2 and UCS4.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+* src/dn.c (append_ucs4_value): Detect the invalid length correctly.
+(append_ucs2_value): Likewise.
+
+--
+
+GnuPG-bug-id: 8476
+Reported-by: Antti Levomäki
+Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
+---
+ src/dn.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/dn.c b/src/dn.c
+index d40c1bb..b7e5811 100644
+--- a/src/dn.c
++++ b/src/dn.c
+@@ -306,7 +306,7 @@ append_ucs4_value (const unsigned char *value, size_t length,
+ append_quoted (sb, value, s-value, 3);
+ if (n>=length)
+ return; /* ready */
+- if (n < 4)
++ if (length - n < 4)
+ { /* This is an invalid encoding - better stop after adding
+ one impossible characater */
+ put_stringbuf_mem (sb, "\xff", 1);
+@@ -400,7 +400,7 @@ append_ucs2_value (const unsigned char *value, size_t length,
+ append_quoted (sb, value, s-value, 1);
+ if (n>=length)
+ return; /* ready */
+- if (n < 2)
++ if (length - n < 2)
+ { /* This is an invalid encoding - better stop after adding
+ one impossible characater */
+ put_stringbuf_mem (sb, "\xff", 1);
+From 4561696808f864fd396d6401d8779d31b0bcf6c1 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe at fsij.org>
+Date: Tue, 6 Oct 2026 10:50:06 +0900
+Subject: [PATCH] Fix attribute to string for UCS4 and UCS2.
+
+* src/dn.c (append_ucs4_value): Use the value[3].
+(append_ucs2_value): Use the value[1].
+
+--
+
+GnuPG-bug-id: 8476
+Reported-by: truong nguyen tri
+Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
+---
+ src/dn.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/dn.c b/src/dn.c
+index b7e5811..6784912 100644
+--- a/src/dn.c
++++ b/src/dn.c
+@@ -285,7 +285,7 @@ append_ucs4_value (const unsigned char *value, size_t length,
+ && (value[3] == ' ' || value[3] == '#'))
+ {
+ tmp[0] = '\\';
+- tmp[1] = *value;
++ tmp[1] = value[3];
+ put_stringbuf_mem (sb, tmp, 2);
+ value += 4;
+ length -= 4;
+@@ -380,7 +380,7 @@ append_ucs2_value (const unsigned char *value, size_t length,
+ if (length>1 && !value[0] && (value[1] == ' ' || value[1] == '#'))
+ {
+ tmp[0] = '\\';
+- tmp[1] = *value;
++ tmp[1] = value[1];
+ put_stringbuf_mem (sb, tmp, 2);
+ value += 2;
+ length -= 2;
diff --git a/libksba-ocsp-double-free.patch b/libksba-ocsp-double-free.patch
new file mode 100644
index 0000000..a45bea2
--- /dev/null
+++ b/libksba-ocsp-double-free.patch
@@ -0,0 +1,43 @@
+Double free of OCSP extensions when a response is parsed twice (GnuPG T8475).
+https://github.com/gpg/libksba/commit/c5dc198f571c26b70a6443ac9a2809d4eea16df2
+
+From c5dc198f571c26b70a6443ac9a2809d4eea16df2 Mon Sep 17 00:00:00 2001
+From: NIIBE Yutaka <gniibe at fsij.org>
+Date: Tue, 6 Oct 2026 11:11:35 +0900
+Subject: [PATCH] Fix cleanup with release_ocsp_extensions.
+
+* src/ocsp.c (ksba_ocsp_parse_response): Clear field
+after calling release_ocsp_extensions.
+
+--
+
+GnuPG-bug-id: 8475
+Reported-by: Bar Hofesh <bar.hofesh at brightsec.com>
+Signed-off-by: NIIBE Yutaka <gniibe at fsij.org>
+---
+ src/ocsp.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/ocsp.c b/src/ocsp.c
+index ffb3bd4..7b94973 100644
+--- a/src/ocsp.c
++++ b/src/ocsp.c
+@@ -1496,8 +1496,9 @@ ksba_ocsp_parse_response (ksba_ocsp_t ocsp,
+ request. This is useful in case of a TryLater response status. */
+ ocsp->response_status = KSBA_OCSP_RSPSTATUS_NONE;
+ release_ocsp_certlist (ocsp->received_certs);
+- release_ocsp_extensions (ocsp->response_extensions);
+ ocsp->received_certs = NULL;
++ release_ocsp_extensions (ocsp->response_extensions);
++ ocsp->response_extensions = NULL;
+ ocsp->hash_length = 0;
+ ocsp->bad_nonce = 0;
+ xfree (ocsp->responder_id.name);
+@@ -1512,6 +1513,7 @@ ksba_ocsp_parse_response (ksba_ocsp_t ocsp,
+ *ri->revocation_time = 0;
+ ri->revocation_reason = 0;
+ release_ocsp_extensions (ri->single_extensions);
++ ri->single_extensions = NULL;
+ }
+
+ /* Run the actual parser. */
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/libksba.git/commitdiff/7373cd025e05879e41668105a0fcaedefaa0b3ea
More information about the pld-cvs-commit
mailing list