diff --git a/package/sudo/0002-Use-accessor-for-getting-an-ASN1_STRING-s-length.patch b/package/sudo/0002-Use-accessor-for-getting-an-ASN1_STRING-s-length.patch new file mode 100644 index 0000000000..eec375f70c --- /dev/null +++ b/package/sudo/0002-Use-accessor-for-getting-an-ASN1_STRING-s-length.patch @@ -0,0 +1,46 @@ +From f97a34bc7b390f185d544e21b0ef75db1275953e Mon Sep 17 00:00:00 2001 +From: Theo Buehler +Date: Sat, 22 Nov 2025 12:28:50 +0100 +Subject: [PATCH] Use accessor for getting an ASN1_STRING's length + +OpensSSL 4 has plans to make ASN1_STRING opaque [1]. hostcheck.c's code +mostly treats it as opaque, but accesses two lengths. This is API added +in OpenSSL 0.9.0, so I'm not sure we need a configure check. + +WolfSSL only recently const corrected ASN1_STRING_length(), so maybe +there will be a need to cast away const. + +[1]: https://github.com/openssl/openssl/issues/29117 + +Upstream: https://github.com/sudo-project/sudo/commit/f97a34bc7b390f185d544e21b0ef75db1275953e + +[Bernd: backported to 1.9.17p2] +Signed-off-by: Bernd Kuhls +--- + lib/iolog/hostcheck.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/iolog/hostcheck.c b/lib/iolog/hostcheck.c +index dbb900e71..8383d2c49 100644 +--- a/lib/iolog/hostcheck.c ++++ b/lib/iolog/hostcheck.c +@@ -323,14 +323,14 @@ matches_subject_alternative_name(const char *hostname, + #endif + + /* IPV4 address */ +- if(current_name->d.iPAddress->length == 4) { ++ if(ASN1_STRING_length(current_name->d.iPAddress) == 4) { + if (inet_ntop(AF_INET, san_ip, san_ip_str, INET_ADDRSTRLEN) == NULL) { + result = MalformedCertificate; + break; + } + #if defined(HAVE_STRUCT_IN6_ADDR) + /* IPV6 address */ +- } else if (current_name->d.iPAddress->length == 16) { ++ } else if (ASN1_STRING_length(current_name->d.iPAddress) == 16) { + if (inet_ntop(AF_INET6, san_ip, san_ip_str, INET6_ADDRSTRLEN) == NULL) { + result = MalformedCertificate; + break; +-- +2.47.3 +