From 2adb7ec286e870e23c4b5abd367a16bae8c5e99c Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sun, 11 Jan 2015 19:59:06 -0500 Subject: [PATCH] ssl_create_cipher_list: check whether push onto cipherstack succeeds (Imported from upstream's f5905ba341ad0fa3731469f10f7fba6f92ecd787.) Change-Id: I92f2f53a127a4f59ce71cf00a9a4aedd0560e586 Reviewed-on: https://boringssl-review.googlesource.com/2832 Reviewed-by: Adam Langley --- ssl/ssl_ciph.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c index 55323d47..60b97472 100644 --- a/ssl/ssl_ciph.c +++ b/ssl/ssl_ciph.c @@ -1066,7 +1066,9 @@ ssl_create_cipher_list(const SSL_PROTOCOL_METHOD *ssl_method, * to the resulting precedence to the STACK_OF(SSL_CIPHER). */ for (curr = head; curr != NULL; curr = curr->next) { if (curr->active) { - sk_SSL_CIPHER_push(cipherstack, curr->cipher); + if (!sk_SSL_CIPHER_push(cipherstack, curr->cipher)) { + goto err; + } in_group_flags[num_in_group_flags++] = curr->in_group; } }