X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=openssl.c;h=723820bf0d0c6579933fa3ae4eb91d8c1197c2df;hp=51fcad588a12f44c5a761c5479693f3c21829031;hb=b987797ccc0276de1f36b8175ce105950d5e97eb;hpb=3bf559678802e4bc352c68caae7bb696ecab1b6b diff --git a/openssl.c b/openssl.c index 51fcad58..723820bf 100644 --- a/openssl.c +++ b/openssl.c @@ -171,7 +171,7 @@ extern int ssl_send_data(struct ssl_attr *ssl_attr, const unsigned char *buf, si */ while ((ret = BIO_write(bio, (const unsigned char *)(buf + pos), - send_len)) < 0) + send_len)) <= 0) { if (!BIO_should_retry(bio)) { @@ -638,6 +638,14 @@ static int ssl_store_cert(struct client_state *csp, X509* crt) len = BIO_get_mem_data(bio, &bio_mem_data); encoded_text = html_encode(bio_mem_data); + if (encoded_text == NULL) + { + log_error(LOG_LEVEL_ERROR, + "Failed to HTML-encode the certificate information"); + ret = -1; + goto exit; + } + strlcpy(last->info_buf, encoded_text, sizeof(last->info_buf)); freez(encoded_text); ret = 0; @@ -821,7 +829,8 @@ extern int create_client_ssl_connection(struct client_state *csp) csp->http->hash_of_host_hex); if (BIO_do_handshake(ssl_attr->openssl_attr.bio) != 1) { - log_ssl_errors(LOG_LEVEL_ERROR, "BIO_do_handshake failed"); + log_ssl_errors(LOG_LEVEL_ERROR, + "The TLS/SSL handshake with the client failed"); ret = -1; goto exit; } @@ -1054,7 +1063,8 @@ extern int create_server_ssl_connection(struct client_state *csp) if (BIO_do_handshake(ssl_attrs->bio) != 1) { - log_ssl_errors(LOG_LEVEL_ERROR, "BIO_do_handshake failed"); + log_ssl_errors(LOG_LEVEL_ERROR, + "The TLS/SSL handshake with the server failed"); ret = -1; goto exit; }