From 4f19a9cb9fa64f361d3e041f7772d8f4fc748efb Mon Sep 17 00:00:00 2001 From: "Dr. Stephen Henson" Date: Thu, 4 Oct 2007 12:07:52 +0000 Subject: [PATCH] Off by one fix from stable branch. --- ssl/ssl_lib.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index c5d9f0e93e..9ed5ff2988 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1277,7 +1277,6 @@ int SSL_set_cipher_list(SSL *s,const char *str) 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; @@ -1290,20 +1289,21 @@ char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len) 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); -- 2.25.1