ssl_create_cipher_list: check whether push onto cipherstack succeeds
authorJonas Maebe <jonas.maebe@elis.ugent.be>
Mon, 2 Dec 2013 21:04:47 +0000 (22:04 +0100)
committerKurt Roeckx <kurt@roeckx.be>
Thu, 4 Dec 2014 22:48:44 +0000 (23:48 +0100)
Signed-off-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Richard Levitte <levitte@openssl.org>
ssl/ssl_ciph.c

index 464a767..a846c75 100644 (file)
@@ -1621,7 +1621,12 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
                if (curr->active)
 #endif
                        {
-                       sk_SSL_CIPHER_push(cipherstack, curr->cipher);
+                       if (!sk_SSL_CIPHER_push(cipherstack, curr->cipher))
+                               {
+                               OPENSSL_free(co_list);
+                               sk_SSL_CIPHER_free(cipherstack);
+                               return NULL;
+                               }
 #ifdef CIPHER_DEBUG
                        printf("<%s>\n",curr->cipher->name);
 #endif