do_othername: check for NULL after allocating objtmp
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Sun, 8 Dec 2013 21:47:10 +0000 (22:47 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 17 Aug 2014 16:56:05 +0000 (18:56 +0200)
Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
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);