From 13f74c66ce83cc554ed29f88706a3176a1788f45 Mon Sep 17 00:00:00 2001 From: FdaSilvaYY Date: Sat, 14 May 2016 23:03:22 +0200 Subject: [PATCH] Constify s2i_ASN1_IA5STRING Return directly NULL after ASN1_STRING_set, as it already has set an error code. Reviewed-by: Matt Caswell Reviewed-by: Kurt Roeckx Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/1074) --- crypto/x509v3/v3_ia5.c | 7 +++---- include/openssl/x509v3.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/crypto/x509v3/v3_ia5.c b/crypto/x509v3/v3_ia5.c index e509fbaf08..5e230df7d0 100644 --- a/crypto/x509v3/v3_ia5.c +++ b/crypto/x509v3/v3_ia5.c @@ -41,7 +41,7 @@ char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5) } ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, char *str) + X509V3_CTX *ctx, const char *str) { ASN1_IA5STRING *ia5; if (!str) { @@ -51,10 +51,9 @@ ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, } if ((ia5 = ASN1_IA5STRING_new()) == NULL) goto err; - if (!ASN1_STRING_set((ASN1_STRING *)ia5, (unsigned char *)str, - strlen(str))) { + if (!ASN1_STRING_set((ASN1_STRING *)ia5, str, strlen(str))) { ASN1_IA5STRING_free(ia5); - goto err; + return NULL; } #ifdef CHARSET_EBCDIC ebcdic2ascii(ia5->data, ia5->data, ia5->length); diff --git a/include/openssl/x509v3.h b/include/openssl/x509v3.h index a1274afe4f..36a437aef8 100644 --- a/include/openssl/x509v3.h +++ b/include/openssl/x509v3.h @@ -481,7 +481,7 @@ STACK_OF(CONF_VALUE) *i2v_ASN1_BIT_STRING(X509V3_EXT_METHOD *method, STACK_OF(CONF_VALUE) *extlist); char *i2s_ASN1_IA5STRING(X509V3_EXT_METHOD *method, ASN1_IA5STRING *ia5); ASN1_IA5STRING *s2i_ASN1_IA5STRING(X509V3_EXT_METHOD *method, - X509V3_CTX *ctx, char *str); + X509V3_CTX *ctx, const char *str); STACK_OF(CONF_VALUE) *i2v_GENERAL_NAME(X509V3_EXT_METHOD *method, GENERAL_NAME *gen, -- 2.34.1