[Commits] [SCM] claws branch, gtk2, updated. 3.20.0-35-g76c8c420e

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


The branch, gtk2 has been updated
       via  76c8c420efd4ee0657e3c532e0bf8a03d06b784c (commit)
      from  5e130d297cb96f223056336c035b0a08628f2784 (commit)

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


- Log -----------------------------------------------------------------
commit 76c8c420efd4ee0657e3c532e0bf8a03d06b784c
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 122da7c1b..e9c582cdd 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