Avoid out-of-bounds write in SSL_get_shared_ciphers

PR: 3317

(Imported from upstream's 8571902e238ba2ef1517185c2a662c03f51dc1bf and
1f5bce2dcebbb5059c2a5ecf4037432e8041cc07)
This commit is contained in:
Adam Langley 2014-06-20 12:00:00 -07:00
parent 9611cfcb9f
commit 041240485d

View File

@ -1518,6 +1518,10 @@ char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len)
p=buf; p=buf;
sk=s->session->ciphers; sk=s->session->ciphers;
if (sk_SSL_CIPHER_num(sk) == 0)
return NULL;
for (i=0; i<sk_SSL_CIPHER_num(sk); i++) for (i=0; i<sk_SSL_CIPHER_num(sk); i++)
{ {
int n; int n;