git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/4] imap-send: check NULL return of SSL_CTX_new()

From
Kazuki Yamaguchi <k@rhe.jp>
Date
Apr 8, 2016, 16:22 UTC
Message-ID
<929766804585e24d7fcdc8acb7dd4835b3069d45.1460130092.git.k@rhe.jp>
In-Reply-To
<cover.1460130092.git.k@rhe.jp>
SSL_CTX_new() may fail with return value NULL.
Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
---
 imap-send.c | 4 ++++
 1 file changed, 4 insertions(+)
diff --git a/imap-send.c b/imap-send.c
index 0364b326e109..c5e24a35491d 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -298,6 +298,10 @@ static int ssl_socket_connect(struct imap_socket *sock, int use_tls_only, int ve
 	}
 
 	ctx = SSL_CTX_new(meth);
+	if (!ctx) {
+		ssl_socket_perror("SSL_CTX_new");
+		return -1;
+	}
 
 	if (verify)
 		SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER, NULL);
-- 
2.8.1.104.g0d1aca6
Previous: Kazuki YamaguchiNext: Kazuki Yamaguchi
Message 3 of 5 in “fix compilation with OpenSSL 1.1.0-pre4”
  1. 0/4 fix compilation with OpenSSL 1.1.0-pre4Kazuki Yamaguchi, Apr 8, 2016
  2. 1/4 imap-send: use HMAC() function provided by OpenSSLKazuki Yamaguchi, Apr 8, 2016
  3. 2/4 imap-send: check NULL return of SSL_CTX_new()Kazuki Yamaguchi, Apr 8, 2016
  4. 3/4 imap-send: avoid deprecated TLSv1_method()Kazuki Yamaguchi, Apr 8, 2016
  5. 4/4 configure: remove checking for HMAC_CTX_cleanupKazuki Yamaguchi, Apr 8, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.