mbedTLS ssl_crt_verify_info(): Ditch trailing new line
authorFabian Keil <fk@fabiankeil.de>
Mon, 18 Jan 2021 00:59:40 +0000 (01:59 +0100)
committerFabian Keil <fk@fabiankeil.de>
Mon, 18 Jan 2021 13:30:39 +0000 (14:30 +0100)
It's not needed for the certificate-error page and it
messed up the "Crunch:" message by splitting it in two.

While at it, remove the leading space which serves no
obvious purpose.

ssl.c

diff --git a/ssl.c b/ssl.c
index ebcac3f..abc7df6 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -1881,7 +1881,16 @@ extern int ssl_base64_encode(unsigned char *dst, size_t dlen, size_t *olen,
  *********************************************************************/
 extern void ssl_crt_verify_info(char *buf, size_t size, struct client_state *csp)
 {
-   mbedtls_x509_crt_verify_info(buf, size, " ", csp->server_cert_verification_result);
+   char *last_byte;
+
+   mbedtls_x509_crt_verify_info(buf, size, "",
+      csp->server_cert_verification_result);
+   last_byte = buf + strlen(buf)-1;
+   if (*last_byte == '\n')
+   {
+      /* Overwrite trailing new line character */
+      *last_byte = '\0';
+   }
 }