emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 1a62721: Port gnutls.c to older (buggier?) GnuTLS


From: Paul Eggert
Subject: [Emacs-diffs] master 1a62721: Port gnutls.c to older (buggier?) GnuTLS
Date: Tue, 18 Jul 2017 03:37:41 -0400 (EDT)

branch: master
commit 1a62721f2d82f7a35a9fc84864f6df0ede2c05c5
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Port gnutls.c to older (buggier?) GnuTLS
    
    Problem reported for GnuTLS 3.2.1 by Glenn Morris in:
    http://lists.gnu.org/archive/html/emacs-devel/2017-07/msg00716.html
    http://lists.gnu.org/archive/html/emacs-devel/2017-07/msg00742.html
    Although I don't see how this bug can occur with vanilla GnuTLS 3.2.1,
    perhaps hydra was using a modified GnuTLS.
    * src/gnutls.c (Fgnutls_ciphers): Don't assume GNUTLS_CIPHER_NULL
    is at the end of the list returned by gnutls_cipher_list,
    or that the earlier ciphers all have non-null names.
---
 src/gnutls.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gnutls.c b/src/gnutls.c
index 9fbaea2..e406d66 100644
--- a/src/gnutls.c
+++ b/src/gnutls.c
@@ -1854,12 +1854,17 @@ The alist key is the cipher name. */)
 
 #ifdef HAVE_GNUTLS3_CIPHER
   const gnutls_cipher_algorithm_t *gciphers = gnutls_cipher_list ();
-  for (ptrdiff_t pos = 0; gciphers[pos] != GNUTLS_CIPHER_NULL; pos++)
+  for (ptrdiff_t pos = 0; gciphers[pos] != 0; pos++)
     {
       gnutls_cipher_algorithm_t gca = gciphers[pos];
+      if (gca == GNUTLS_CIPHER_NULL)
+       continue;
+      char const *cipher_name = gnutls_cipher_get_name (gca);
+      if (!cipher_name)
+       continue;
 
       /* A symbol representing the GnuTLS cipher.  */
-      Lisp_Object cipher_symbol = intern (gnutls_cipher_get_name (gca));
+      Lisp_Object cipher_symbol = intern (cipher_name);
 
       ptrdiff_t cipher_tag_size = gnutls_cipher_get_tag_size (gca);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]