[gnutls-dev] bugreport: segmentation fault in gnutls_certificate_set_x509_crl()

Max Kellermann max at duempel.org
Wed Dec 13 08:52:58 CET 2006


On 2006/12/11 08:52, Max Kellermann <max at duempel.org> wrote:
> I suggest adding gnutls_x509_crl_init() before each
> _gnutls_x509_crl_cpy() call.

Here is a patch.

Max

-------------- next part --------------
Index: lib/gnutls_x509.c
===================================================================
RCS file: /cvs/gnutls/gnutls/lib/gnutls_x509.c,v
retrieving revision 2.175
diff -u -r2.175 gnutls_x509.c
--- lib/gnutls_x509.c	16 Jun 2006 13:29:36 -0000	2.175
+++ lib/gnutls_x509.c	13 Dec 2006 07:45:46 -0000
@@ -1623,14 +1623,21 @@
 
   for (i = 0; i < crl_list_size; i++)
     {
+      ret = gnutls_x509_crl_init (&res->x509_crl_list[res->x509_ncrls]);
+      if (ret < 0)
+	{
+	  gnutls_assert ();
+	  return ret;
+	}
+
       ret = _gnutls_x509_crl_cpy (res->x509_crl_list[ res->x509_ncrls],
 				  crl_list[i]);
+      res->x509_ncrls++;
       if (ret < 0)
 	{
 	  gnutls_assert ();
 	  return ret;
 	}
-      res->x509_ncrls++;
     }
 
   return 0;


More information about the Gnutls-devel mailing list