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 <agl@google.com>
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c
index 55323d4..60b9747 100644
--- a/ssl/ssl_ciph.c
+++ b/ssl/ssl_ciph.c
@@ -1066,7 +1066,9 @@
* 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;
}
}