From d84d69dfbc5f64e9020ce38d2cbd60fe39cb27b9 Mon Sep 17 00:00:00 2001 From: Robert Pluim Date: Thu, 25 Feb 2021 16:36:56 +0100 Subject: [PATCH] Don't crash if gnutls_handshake fails In some situations involving Internet access not being fully functional, gnutls_handshake returns a fatal error, which we were ignoring, causing us to call gnutls_handshake again. Now we check for the error and return it to the caller. * src/gnutls.c (gnutls_try_handshake): Return immediately if gnutls_handshake returns a fatal error (Bug#46709). --- src/gnutls.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gnutls.c b/src/gnutls.c index aa245ee5c39..4d5a909db0d 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -625,6 +625,8 @@ gnutls_try_handshake (struct Lisp_Process *proc) while ((ret = gnutls_handshake (state)) < 0) { + if (gnutls_error_is_fatal (ret)) + return emacs_gnutls_handle_error (state, ret); do ret = gnutls_handshake (state); while (ret == GNUTLS_E_INTERRUPTED); -- 2.39.2