From 5947149f2d5f6bd00b40724addc10b4a9ac5f824 Mon Sep 17 00:00:00 2001
From: tb <>
Date: Fri, 21 Oct 2022 15:48:14 +0000
Subject: Add extra NULL check after ssl3_setup_read_buffer()

While ssl3_setup_read_buffer() success alone is enough to imply that
the read bufer is non-NULL, several static analyzers fail to recognize
that and throw fits about possible NULL accesses.

CID 331010

Fix from and ok jsing
---
 src/lib/libssl/ssl_pkt.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/lib')

diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c
index 8462d03967..ddb2ce0935 100644
--- a/src/lib/libssl/ssl_pkt.c
+++ b/src/lib/libssl/ssl_pkt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ssl_pkt.c,v 1.61 2022/10/02 16:36:41 jsing Exp $ */
+/* $OpenBSD: ssl_pkt.c,v 1.62 2022/10/21 15:48:14 tb Exp $ */
 /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
  * All rights reserved.
  *
@@ -158,9 +158,12 @@ ssl3_read_n(SSL *s, int n, int max, int extend)
 	if (n <= 0)
 		return n;
 
-	if (rb->buf == NULL)
+	if (rb->buf == NULL) {
 		if (!ssl3_setup_read_buffer(s))
 			return -1;
+	}
+	if (rb->buf == NULL)
+		return -1;
 
 	left = rb->left;
 	align = (size_t)rb->buf + SSL3_RT_HEADER_LENGTH;
-- 
cgit v1.2.3-55-g6feb