[exim-cvs] fix size param for gnutls_dh_params_export_pkcs3(…

Top Pagina
Delete this message
Reply to this message
Auteur: Exim Git Commits Mailing List
Datum:  
Aan: exim-cvs
Onderwerp: [exim-cvs] fix size param for gnutls_dh_params_export_pkcs3() again
Gitweb: http://git.exim.org/exim.git/commitdiff/1f00591e43de58718045ab86916011cc564e5201
Commit:     1f00591e43de58718045ab86916011cc564e5201
Parent:     f88b6b91544b58850beaacba37f206506f5c3812
Author:     Phil Pennock <pdp@???>
AuthorDate: Sat May 26 20:10:40 2012 -0400
Committer:  Phil Pennock <pdp@???>
CommitDate: Sat May 26 20:10:40 2012 -0400


    fix size param for gnutls_dh_params_export_pkcs3() again
---
 src/src/tls-gnu.c |    9 +++------
 1 files changed, 3 insertions(+), 6 deletions(-)


diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c
index b2659d7..aa2f925 100644
--- a/src/src/tls-gnu.c
+++ b/src/src/tls-gnu.c
@@ -512,18 +512,15 @@ if (rc < 0)
   m.data = malloc(m.size);
   if (m.data == NULL)
     return tls_error(US"memory allocation failed", strerror(errno), NULL);
-  /* this will return a size 1 less than the allocation size above; I
-  originally used sz so as to avoid type compatibility errors, as gnutls_datum
-  uses "unsigned int" for the size field, but this call takes separate data
-  and size fields, with the latter being a size_t*.  For now, we live with
-  the error as being safer than throwing away type information. */
+  /* this will return a size 1 less than the allocation size above */
   rc = gnutls_dh_params_export_pkcs3(dh_server_params, GNUTLS_X509_FMT_PEM,
-      m.data, &m.size);
+      m.data, &sz);
   if (rc != GNUTLS_E_SUCCESS)
     {
     free(m.data);
     exim_gnutls_err_check(US"gnutls_dh_params_export_pkcs3() real");
     }
+  m.size = sz; /* shrink by 1, probably */


sz = write_to_fd_buf(fd, m.data, (size_t) m.size);
if (sz != m.size)