See ftp://ftp.openbsd.org/pub/OpenBSD/patches/4.0/common/017_openssl.patch for original works. This patch was copied from there, and made to work on 3.6. To apply patch, do this: cd /usr/src/lib/libssl/src/ssl ftp http://www.bogus.net/~torh/files/017_openssl.openbsd_3_6.patch patch -p0 < 017_openssl.openbsd_3_6.patch cd ../../ make obj make depend make make install --- ssl_lib.c.orig Sun Oct 14 00:30:45 2007 +++ ssl_lib.c Sun Oct 14 00:37:52 2007 @@ -1147,36 +1147,33 @@ /* works well for SSLv2, not so good for SSLv3 */ char *SSL_get_shared_ciphers(SSL *s,char *buf,int len) { - char *p; - const char *cp; + char *end; STACK_OF(SSL_CIPHER) *sk; SSL_CIPHER *c; + size_t curlen = 0; int i; if ((s->session == NULL) || (s->session->ciphers == NULL) || (len < 2)) return(NULL); - p=buf; sk=s->session->ciphers; + buf[0] = '\0'; for (i=0; iname; *cp; ) + end = buf + curlen; + if (strlcat(buf, c->name, len) >= len || + (curlen = strlcat(buf, ":", len)) >= len) { - if (len-- == 0) - { - *p='\0'; - return(buf); - } - else - *(p++)= *(cp++); + /* remove truncated cipher from list */ + *end = '\0'; + break; } - *(p++)=':'; } - p[-1]='\0'; + /* remove trailing colon */ + if ((end = strrchr(buf, ':')) != NULL) + *end = '\0'; return(buf); }