Projects
home:rottame:vhosts-ng
openssl-1_1
openssl-CVE-2026-34180.patch
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File openssl-CVE-2026-34180.patch of Package openssl-1_1
From 5cbaa1d66144774f57312a568cabb9a83b8b0d01 Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni <viktor@openssl.org> Date: Fri, 15 May 2026 04:19:32 +1000 Subject: [PATCH] Avoid length truncation in ASN1_STRING_set The ASN1_STRING_set() function takes an `int` length, make sure the argument is not inadvertently truncated when it is called from asn1_ex_c2i(). Fixes CVE-2026-34180 --- crypto/asn1/tasn_dec.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) Index: openssl-1.1.1w/crypto/asn1/tasn_dec.c =================================================================== --- openssl-1.1.1w.orig/crypto/asn1/tasn_dec.c +++ openssl-1.1.1w/crypto/asn1/tasn_dec.c @@ -57,7 +57,7 @@ static int asn1_d2i_ex_primitive(ASN1_VA const ASN1_ITEM *it, int tag, int aclass, char opt, ASN1_TLC *ctx); -static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, +static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, long len, int utype, char *free_cont, const ASN1_ITEM *it); /* Table to convert tags to bit values, used for MSTRING type */ @@ -790,19 +790,24 @@ static int asn1_d2i_ex_primitive(ASN1_VA /* Translate ASN1 content octets into a structure */ -static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, int len, +static int asn1_ex_c2i(ASN1_VALUE **pval, const unsigned char *cont, long len, int utype, char *free_cont, const ASN1_ITEM *it) { ASN1_VALUE **opval = NULL; ASN1_STRING *stmp; ASN1_TYPE *typ = NULL; int ret = 0; + int ilen = (int)len; const ASN1_PRIMITIVE_FUNCS *pf; ASN1_INTEGER **tint; pf = it->funcs; - if (pf && pf->prim_c2i) - return pf->prim_c2i(pval, cont, len, utype, free_cont, it); + if (pf && pf->prim_c2i) { + if (len == (long)ilen) + return pf->prim_c2i(pval, cont, ilen, utype, free_cont, it); + ASN1err(ASN1_F_ASN1_EX_C2I, ASN1_R_TOO_LONG); + return 0; + } /* If ANY type clear type and set pointer to internal value */ if (it->utype == V_ASN1_ANY) { if (!*pval) { @@ -820,7 +825,8 @@ static int asn1_ex_c2i(ASN1_VALUE **pval } switch (utype) { case V_ASN1_OBJECT: - if (!c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, len)) + if (len != (long)ilen + || !c2i_ASN1_OBJECT((ASN1_OBJECT **)pval, &cont, ilen)) goto err; break; @@ -875,6 +881,10 @@ static int asn1_ex_c2i(ASN1_VALUE **pval case V_ASN1_SET: case V_ASN1_SEQUENCE: default: + if (len != (long)ilen) { + ASN1err(ASN1_F_ASN1_EX_C2I, ASN1_R_TOO_LONG); + goto err; + } if (utype == V_ASN1_BMPSTRING && (len & 1)) { ASN1err(ASN1_F_ASN1_EX_C2I, ASN1_R_BMPSTRING_IS_WRONG_LENGTH); goto err; @@ -900,10 +910,10 @@ static int asn1_ex_c2i(ASN1_VALUE **pval if (*free_cont) { OPENSSL_free(stmp->data); stmp->data = (unsigned char *)cont; /* UGLY CAST! RL */ - stmp->length = len; + stmp->length = ilen; *free_cont = 0; } else { - if (!ASN1_STRING_set(stmp, cont, len)) { + if (!ASN1_STRING_set(stmp, cont, ilen)) { ASN1err(ASN1_F_ASN1_EX_C2I, ERR_R_MALLOC_FAILURE); ASN1_STRING_free(stmp); *pval = NULL;
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.