diff options
author | Ben Laurie <ben@openssl.org> | 2007-09-19 12:16:21 +0000 |
---|---|---|
committer | Ben Laurie <ben@openssl.org> | 2007-09-19 12:16:21 +0000 |
commit | 458c3900e1e96ef2c2fc1c7778d0e619c4ab1696 (patch) | |
tree | e21b01657507e6372f562a1bdf35f0cdad365874 /ssl | |
parent | ba75b4e7505baf49520d9aaa75da2f6197d8259f (diff) |
Lingering "security" fix.
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/ssl_lib.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index 31fd26d41b..73707aab9b 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -1210,7 +1210,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; @@ -1223,20 +1222,21 @@ char *SSL_get_shared_ciphers(const SSL *s,char *buf,int len) sk=s->session->ciphers; for (i=0; i<sk_SSL_CIPHER_num(sk); i++) { - /* Decrement for either the ':' or a '\0' */ - len--; + int n; + c=sk_SSL_CIPHER_value(sk,i); - for (cp=c->name; *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); |