projects
/
privoxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
ssl_store_cert(): Handle html_encode() failures
[privoxy.git]
/
openssl.c
diff --git
a/openssl.c
b/openssl.c
index
51fcad5
..
723820b
100644
(file)
--- 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),
*/
while ((ret = BIO_write(bio,
(const unsigned char *)(buf + pos),
- send_len)) < 0)
+ send_len)) <
=
0)
{
if (!BIO_should_retry(bio))
{
{
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);
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;
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)
{
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;
}
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)
{
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;
}
ret = -1;
goto exit;
}