[exim-cvs] avoid NUL in dh params file

Top Page
Delete this message
Reply to this message
Author: Exim Git Commits Mailing List
Date:  
To: exim-cvs
Subject: [exim-cvs] avoid NUL in dh params file
Gitweb: http://git.exim.org/exim.git/commitdiff/76d5098363019ec2c5a9b0f584c78a15a92e3bab
Commit:     76d5098363019ec2c5a9b0f584c78a15a92e3bab
Parent:     f53d7cf7c6d5af5dd7c5c040e641b665e3d8f7e7
Author:     Phil Pennock <pdp@???>
AuthorDate: Mon May 21 05:54:50 2012 -0400
Committer:  Phil Pennock <pdp@???>
CommitDate: Mon May 21 05:56:03 2012 -0400


    avoid NUL in dh params file


    gnutls_dh_params_export_pkcs3() returns 2 different sizes.
    NUL observed by Janne Snabb
---
 src/src/tls-gnu.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/src/src/tls-gnu.c b/src/src/tls-gnu.c
index 3ea02bd..0ac72ad 100644
--- a/src/src/tls-gnu.c
+++ b/src/src/tls-gnu.c
@@ -512,8 +512,9 @@ 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 */
   rc = gnutls_dh_params_export_pkcs3(dh_server_params, GNUTLS_X509_FMT_PEM,
-      m.data, &sz);
+      m.data, &m.size);
   if (rc != GNUTLS_E_SUCCESS)
     {
     free(m.data);