[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 1071a4f: Fix crashes in networking with GnuTLS on M
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 1071a4f: Fix crashes in networking with GnuTLS on MS-Windows |
Date: |
Mon, 26 Aug 2019 12:07:07 -0400 (EDT) |
branch: master
commit 1071a4fac6f2e70572a1259e073124cbb723e90d
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Fix crashes in networking with GnuTLS on MS-Windows
* src/gnutls.c (init_gnutls_functions) [WINDOWSNT]: Define and
load gnutls_free.
(Fgnutls_format_certificate): Use gnutls_free instead of
xfree. This prevents crashes on MS-Windows, since the memory
being released was allocated inside GnuTLS. (Bug#31946)
---
src/gnutls.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/gnutls.c b/src/gnutls.c
index a7ef59a..67d1fb9 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -140,6 +140,7 @@ DEF_DLL_FN (void, gnutls_dh_set_prime_bits,
DEF_DLL_FN (int, gnutls_dh_get_prime_bits, (gnutls_session_t));
DEF_DLL_FN (int, gnutls_error_is_fatal, (int));
DEF_DLL_FN (int, gnutls_global_init, (void));
+DEF_DLL_FN (void, gnutls_free, (void *));
DEF_DLL_FN (void, gnutls_global_set_log_function, (gnutls_log_func));
# ifdef HAVE_GNUTLS3
DEF_DLL_FN (void, gnutls_global_set_audit_log_function,
(gnutls_audit_log_func));
@@ -326,6 +327,7 @@ init_gnutls_functions (void)
LOAD_DLL_FN (library, gnutls_dh_get_prime_bits);
LOAD_DLL_FN (library, gnutls_error_is_fatal);
LOAD_DLL_FN (library, gnutls_global_init);
+ LOAD_DLL_FN (library, gnutls_free);
LOAD_DLL_FN (library, gnutls_global_set_log_function);
# ifdef HAVE_GNUTLS3
LOAD_DLL_FN (library, gnutls_global_set_audit_log_function);
@@ -463,6 +465,7 @@ init_gnutls_functions (void)
# define gnutls_global_init fn_gnutls_global_init
# define gnutls_global_set_audit_log_function
fn_gnutls_global_set_audit_log_function
# define gnutls_global_set_log_function fn_gnutls_global_set_log_function
+# define gnutls_free fn_gnutls_free
# define gnutls_global_set_log_level fn_gnutls_global_set_log_level
# define gnutls_handshake fn_gnutls_handshake
# define gnutls_init fn_gnutls_init
@@ -1613,7 +1616,7 @@ string representation. */)
memset (out_buf, 0, (out.size + 1) * sizeof (char));
memcpy (out_buf, out.data, out.size);
- xfree (out.data);
+ gnutls_free (out.data);
gnutls_x509_crt_deinit (crt);
Lisp_Object result = build_string (out_buf);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 1071a4f: Fix crashes in networking with GnuTLS on MS-Windows,
Eli Zaretskii <=