--- a/ssl/ssl_lib.c 2007/08/12 18:59:02 1.133.2.9 +++ b/ssl/ssl_lib.c 2007/09/19 12:16:21 1.133.2.10 @@ -1210,7 +1210,6 @@ char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len) { char *p; - const char *cp; STACK_OF(SSL_CIPHER) *sk; SSL_CIPHER *c; int i; @@ -1223,20 +1222,21 @@ sk=s->session->ciphers; for (i=0; iname; *cp; ) + n=strlen(c->name); + if (n+1 > len) { - if (len-- <= 0) - { - *p='\0'; - return(buf); - } - else - *(p++)= *(cp++); + if (p != buf) + --p; + *p='\0'; + return buf; } + strcpy(p,c->name); + p+=n; *(p++)=':'; + len-=n+1; } p[-1]='\0'; return(buf);