[Commits] [SCM] claws branch, master, updated. 4.2.0-36-ge67ebcf6e

mones at claws-mail.org mones at claws-mail.org
Fri Jan 12 12:03:27 UTC 2024


The branch, master has been updated
       via  e67ebcf6e95406d72b604fd5b764d58a76a1a708 (commit)
      from  4395a2a4f950a72580b65564b01bc105de2f37d2 (commit)

Summary of changes:
 src/common/ssl_certificate.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)


- Log -----------------------------------------------------------------
commit e67ebcf6e95406d72b604fd5b764d58a76a1a708
Author: Ricardo Mones <ricardo at mones.org>
Date:   Fri Jan 12 13:02:34 2024 +0100

    Fail earlier when certificate sizes differ
    
    There's no need to allocate memory and waste cycles exporting
    certificates to fail afterwards because sizes differ.

diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
index f0c470f08..f9dbd3b3c 100644
--- a/src/common/ssl_certificate.c
+++ b/src/common/ssl_certificate.c
@@ -494,6 +494,11 @@ static gboolean ssl_certificate_compare (SSLCertificate *cert_a, SSLCertificate
 		return FALSE;
 	}
 
+	if (cert_size_a != cert_size_b) {
+		debug_print("sizes differ: %"G_GSIZE_FORMAT" != %"G_GSIZE_FORMAT"\n", cert_size_a, cert_size_b);
+		return FALSE;
+	}
+
 	output_a = g_malloc(cert_size_a);
 	output_b = g_malloc(cert_size_b);
 	if ((r = gnutls_x509_crt_export(cert_a->x509_cert, GNUTLS_X509_FMT_DER, output_a, &cert_size_a)) < 0) {
@@ -508,12 +513,6 @@ static gboolean ssl_certificate_compare (SSLCertificate *cert_a, SSLCertificate
 		g_free(output_b);
 		return FALSE;
 	}
-	if (cert_size_a != cert_size_b) {
-		debug_print("sizes differ: %"G_GSIZE_FORMAT" != %"G_GSIZE_FORMAT"\n", cert_size_a, cert_size_b);
-		g_free(output_a);
-		g_free(output_b);
-		return FALSE;
-	}
 	if (memcmp(output_a, output_b, cert_size_a)) {
 		debug_print("contents differ\n");
 		g_free(output_a);

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list