From d44ea3f77cee3c7edc5f7bfb065326dc031d5ed6 Mon Sep 17 00:00:00 2001 From: "Thierry FOURNIER / OZON.IO" Date: Fri, 14 Oct 2016 00:49:21 +0200 Subject: [PATCH] BUILD/CLEANUP: ssl: Check BIO_reset() return code The BIO_reset function can fails, and the error is not processed. This patch just take in account the return code of the BIO_reset() function. --- src/ssl_sock.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ssl_sock.c b/src/ssl_sock.c index f00b358b8..4b1e8856f 100644 --- a/src/ssl_sock.c +++ b/src/ssl_sock.c @@ -1830,7 +1830,11 @@ static int ssl_sock_load_crt_file_into_ckch(const char *path, struct cert_key_an } /* Seek back to beginning of file */ - BIO_reset(in); + if (BIO_reset(in) == -1) { + memprintf(err, "%san error occurred while reading the file '%s'.\n", + err && *err ? *err : "", path); + goto end; + } /* Read Certificate */ ckch->cert = PEM_read_bio_X509_AUX(in, NULL, NULL, NULL);