ssl_verify_callback(): Handle html_encode() failures
authorFabian Keil <fk@fabiankeil.de>
Wed, 26 Aug 2020 13:45:08 +0000 (15:45 +0200)
committerFabian Keil <fk@fabiankeil.de>
Tue, 1 Sep 2020 10:22:42 +0000 (12:22 +0200)
Sponsored by: Robert Klemme

ssl.c

diff --git a/ssl.c b/ssl.c
index 30b6f58..1eb6e82 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -1726,6 +1726,12 @@ static int ssl_verify_callback(void *csp_void, mbedtls_x509_crt *crt,
 
       mbedtls_x509_crt_info(buf, sizeof(buf), CERT_INFO_PREFIX, crt);
       encoded_text = html_encode(buf);
+      if (encoded_text == NULL)
+      {
+         log_error(LOG_LEVEL_ERROR,
+            "Failed to HTML-encode the certificate information");
+         return -1;
+      }
       strlcpy(last->info_buf, encoded_text, sizeof(last->info_buf));
       freez(encoded_text);
    }