Check sk_SSL_CIPHER_num() after assigning sk.
authorKurt Roeckx <kurt@roeckx.be>
Mon, 12 May 2014 16:19:14 +0000 (18:19 +0200)
committerMatt Caswell <matt@openssl.org>
Mon, 12 May 2014 21:56:13 +0000 (22:56 +0100)
ssl/ssl_lib.c

index 047f69aeed8a403df235be656e37f9863e491484..4720680769f4736da7a62ecb1e3c2744cfb92a3f 100644 (file)
@@ -1457,11 +1457,12 @@ char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len)
                (len < 2))
                return(NULL);
 
+       p=buf;
+       sk=s->session->ciphers;
+
        if (sk_SSL_CIPHER_num(sk) == 0)
                return NULL;
 
-       p=buf;
-       sk=s->session->ciphers;
        for (i=0; i<sk_SSL_CIPHER_num(sk); i++)
                {
                int n;