Convert CRYPTO_LOCK_X509_* to new multi-threading API
[openssl.git] / crypto / x509v3 / v3_alt.c
index b3c3644bb365ae2bb98f246a9de20468d0f5a2cf..4b143f95c83fa2c8f53912ef1b9ce6e415838465 100644 (file)
@@ -1,4 +1,3 @@
-/* v3_alt.c */
 /*
  * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
  * project.
@@ -61,6 +60,7 @@
 #include "internal/cryptlib.h"
 #include <openssl/conf.h>
 #include <openssl/x509v3.h>
+#include "ext_dat.h"
 
 static GENERAL_NAMES *v2i_subject_alt(X509V3_EXT_METHOD *method,
                                       X509V3_CTX *ctx,
@@ -577,11 +577,9 @@ static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx)
     if ((gen->d.otherName->value = ASN1_generate_v3(p + 1, ctx)) == NULL)
         return 0;
     objlen = p - value;
-    objtmp = OPENSSL_malloc(objlen + 1);
+    objtmp = OPENSSL_strndup(value, objlen);
     if (objtmp == NULL)
         return 0;
-    strncpy(objtmp, value, objlen);
-    objtmp[objlen] = 0;
     gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0);
     OPENSSL_free(objtmp);
     if (!gen->d.otherName->type_id)