do_othername: check for NULL after allocating objtmp
[openssl.git] / crypto / x509v3 / v3_alt.c
index d29d94338ec506b77d2f0fde904a50b89551368c..ea1410dd74e3fa202d1a25f1e58af05e11c66a6c 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);