From 72a509f94fc2be80c9903b7512715cd526a82e25 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Thu, 26 Aug 2021 15:08:15 +0200 Subject: Make the -DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION pass tests Fixes #16428 Reviewed-by: Paul Dale Reviewed-by: Bernd Edlinger (Merged from https://github.com/openssl/openssl/pull/16433) --- crypto/asn1/a_print.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crypto/asn1/a_print.c') diff --git a/crypto/asn1/a_print.c b/crypto/asn1/a_print.c index 328e0abcc5..e04f9b1f2e 100644 --- a/crypto/asn1/a_print.c +++ b/crypto/asn1/a_print.c @@ -18,12 +18,13 @@ int ASN1_PRINTABLE_type(const unsigned char *s, int len) int ia5 = 0; int t61 = 0; - if (len <= 0) - len = -1; if (s == NULL) return V_ASN1_PRINTABLESTRING; - while ((*s) && (len-- != 0)) { + if (len < 0) + len = strlen((const char *)s); + + while (len-- > 0) { c = *(s++); if (!ossl_isasn1print(c)) ia5 = 1; -- cgit v1.2.3