From: tb Date: Tue, 24 May 2022 19:56:13 +0000 (+0000) Subject: Use asn1_abs_set_unused_bits() in asn1_str2type() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=078809e2d47e2b8bf41d39b1c111e25c0af284d6;p=openbsd Use asn1_abs_set_unused_bits() in asn1_str2type() ok jsing --- diff --git a/lib/libcrypto/asn1/asn1_gen.c b/lib/libcrypto/asn1/asn1_gen.c index d800b77a6a1..a37091ce7d2 100644 --- a/lib/libcrypto/asn1/asn1_gen.c +++ b/lib/libcrypto/asn1/asn1_gen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: asn1_gen.c,v 1.18 2021/12/25 13:17:48 jsing Exp $ */ +/* $OpenBSD: asn1_gen.c,v 1.19 2022/05/24 19:56:13 tb Exp $ */ /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL * project 2002. */ @@ -62,6 +62,8 @@ #include #include +#include "asn1_locl.h" + #define ASN1_GEN_FLAG 0x10000 #define ASN1_GEN_FLAG_IMP (ASN1_GEN_FLAG|1) #define ASN1_GEN_FLAG_EXP (ASN1_GEN_FLAG|2) @@ -754,10 +756,9 @@ asn1_str2type(const char *str, int format, int utype) } if ((utype == V_ASN1_BIT_STRING) && no_unused) { - atmp->value.asn1_string->flags &= - ~(ASN1_STRING_FLAG_BITS_LEFT | 0x07); - atmp->value.asn1_string->flags |= - ASN1_STRING_FLAG_BITS_LEFT; + if (!asn1_abs_set_unused_bits(atmp->value.asn1_string, + 0)) + goto bad_str; } break;