Constify s2i_ASN1_IA5STRING
authorFdaSilvaYY <fdasilvayy@gmail.com>
Sat, 14 May 2016 21:03:22 +0000 (23:03 +0200)
committerRich Salz <rsalz@openssl.org>
Sun, 5 Jun 2016 01:30:41 +0000 (21:30 -0400)
Return directly NULL after ASN1_STRING_set, as it already has set an error code.

Reviewed-by: Matt Caswell <matt@openssl.org>
Reviewed-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/1074)

crypto/x509v3/v3_ia5.c
include/openssl/x509v3.h

index e509fbaf0853d80142049ce630b9b84e7ef4ad8c..5e230df7d00bebce07bf2f6deb82a987c0250861 100644 (file)
@@ -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);
index a1274afe4f75154fb0a5d5176a0b10e67a6fc7e2..36a437aef8e9d19fa11ca5d0ded0d2307f3037c8 100644 (file)
@@ -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,