do_othername: check for NULL after allocating objtmp
[openssl.git] / crypto / x509v3 / v3_alt.c
index d29d943..ea1410d 100644 (file)
@@ -579,6 +579,8 @@ static int do_othername(GENERAL_NAME *gen, char *value, X509V3_CTX *ctx)
                return 0;
        objlen = p - value;
        objtmp = OPENSSL_malloc(objlen + 1);
+       if (objtmp == NULL)
+               return 0;
        strncpy(objtmp, value, objlen);
        objtmp[objlen] = 0;
        gen->d.otherName->type_id = OBJ_txt2obj(objtmp, 0);