UI_construct_prompt: check for NULL when allocating prompt
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Sun, 8 Dec 2013 21:45:15 +0000 (22:45 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Sun, 17 Aug 2014 16:54:49 +0000 (18:54 +0200)
Signed-off-by: Kurt Roeckx <kurt@openssl.org>
Reviewed-by: Dr. Stephen Henson <steve@openssl.org>
crypto/ui/ui_lib.c

index 167da002d24c7197b85e0bef250cf84b98ec973a..41bc926ca4c6ec15a2901d3177a89bbbd5e68540 100644 (file)
@@ -431,6 +431,8 @@ char *UI_construct_prompt(UI *ui, const char *object_desc,
                len += sizeof(prompt3) - 1;
 
                prompt = (char *)OPENSSL_malloc(len + 1);
                len += sizeof(prompt3) - 1;
 
                prompt = (char *)OPENSSL_malloc(len + 1);
+               if (prompt == NULL)
+                       return NULL;
                BUF_strlcpy(prompt, prompt1, len + 1);
                BUF_strlcat(prompt, object_desc, len + 1);
                if (object_name)
                BUF_strlcpy(prompt, prompt1, len + 1);
                BUF_strlcat(prompt, object_desc, len + 1);
                if (object_name)