Fix ssl3_send_new_session_ticket error-handling.

If there is a malloc failure while assembling the ticket, call
CBB_cleanup. Also return -1 instead of 0; zero means EOF in the old
state machine and -1 means error. (Except enough of the stack gets it
wrong that consumers handle both, but we should fix this.)

Change-Id: I98541a9fa12772ec159f9992d1f9f53e5ca4cc5a
Reviewed-on: https://boringssl-review.googlesource.com/12104
Commit-Queue: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
This commit is contained in:
David Benjamin 2016-11-03 18:06:27 -04:00 committed by Adam Langley
parent 0a011fc49f
commit e75cc2766c

View File

@ -1840,7 +1840,8 @@ static int ssl3_send_new_session_ticket(SSL *ssl) {
? ssl->session
: ssl->s3->new_session) ||
!ssl->method->finish_message(ssl, &cbb)) {
return 0;
CBB_cleanup(&cbb);
return -1;
}
ssl->state = SSL3_ST_SW_SESSION_TICKET_B;