--- openssl-0.9.8a/ssl/ssl_lib.c 2005-10-01 00:38:20.000000000 +0100 +++ openssl-0.9.8a.new/ssl/ssl_lib.c 2006-08-28 19:08:37.401404000 +0100 @@ -1219,7 +1219,7 @@ char *SSL_get_shared_ciphers(const SSL * c=sk_SSL_CIPHER_value(sk,i); for (cp=c->name; *cp; ) { - if (len-- == 0) + if (len-- <= 0) { *p='\0'; return(buf); --- openssl-0.9.8a/ssl/s3_srvr.c 2005-10-01 00:38:20.000000000 +0100 +++ openssl-0.9.8a.new/ssl/s3_srvr.c 2006-08-28 19:16:39.313556000 +0100 @@ -2017,7 +2017,7 @@ int ssl3_get_client_key_exchange(SSL *s) if (kssl_ctx->client_princ) { - int len = strlen(kssl_ctx->client_princ); + size_t len = strlen(kssl_ctx->client_princ); if ( len < SSL_MAX_KRB5_PRINCIPAL_LENGTH ) { s->session->krb5_client_princ_len = len; --- openssl-0.9.8a/ssl/s2_clnt.c 2005-08-06 00:52:07.000000000 +0100 +++ openssl-0.9.8a.new/ssl/s2_clnt.c 2006-08-28 19:14:59.398605000 +0100 @@ -520,7 +520,8 @@ static int get_server_hello(SSL *s) CRYPTO_add(&s->session->peer->references, 1, CRYPTO_LOCK_X509); } - if (s->session->peer != s->session->sess_cert->peer_key->x509) + if (s->session->sess_cert == NULL + || s->session->peer != s->session->sess_cert->peer_key->x509) /* can't happen */ { ssl2_return_error(s, SSL2_PE_UNDEFINED_ERROR);