Patch for wrong size allocation in ne_gnutls.c

Henrik Holst henrik.holst at millistream.com
Wed Nov 14 11:01:22 EST 2018


Hi,

  ne_gnutls.c makes a malloc for the size of the pointer to the
gnutls_pcert_st structure instead of the size of the structure itself.

I also changed from malloc to calloc in case gnutls_pcert_import_x509()
reads from any of the structure members before filling it in (a bit unsure
about the requirements of the GnuTLS library).

I've attached the patch both inline and as an attached file since Gmail
(which I use) have a tendendency to bork inline patches:

--- ne_gnutls.c.org    2018-11-14 16:18:17.937532267 +0100
+++ ne_gnutls.c    2018-11-14 16:18:33.465205564 +0100
@@ -660,7 +660,7 @@
                 return ret;
             }

-            *pcert = gnutls_malloc(sizeof *pcert);
+            *pcert = gnutls_calloc(1, sizeof **pcert);
             gnutls_pcert_import_x509(*pcert,
sess->client_cert->cert.subject, 0);
             *pcert_length = 1;
 #else /* !HAVE_GNUTLS_CERTIFICATE_SET_RETRIEVE_FUNCTION2 */
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.manyfish.co.uk/pipermail/neon/attachments/20181114/79494e52/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ne_gnutls.c.diff
Type: text/x-patch
Size: 469 bytes
Desc: not available
Url : http://lists.manyfish.co.uk/pipermail/neon/attachments/20181114/79494e52/attachment.bin 


More information about the neon mailing list