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:59:11 +0000 (22:59 +0100)
ssl/ssl_lib.c

index 0a7e2aad2dc0e444fa86395cb9d30d4d5d4b5a53..00b26ba429f89e8f568a75f7c6e517ed73071c7b 100644 (file)
@@ -1467,11 +1467,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;