commit:     ee0c9433da1197186bef013eb84a26c0aad69607
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 20 17:38:29 2018 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Wed Jun 20 17:39:38 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=ee0c9433

net-libs/libssh2: Fix openssl-1.1 memleak (#630804)

Package-Manager: Portage-2.3.40, Repoman-2.3.9

 .../files/libssh2-1.8.0-openssl11-memleak.patch    | 23 ++++++++++++++++++++++
 net-libs/libssh2/libssh2-1.8.0-r1.ebuild           |  1 +
 2 files changed, 24 insertions(+)

diff --git a/net-libs/libssh2/files/libssh2-1.8.0-openssl11-memleak.patch 
b/net-libs/libssh2/files/libssh2-1.8.0-openssl11-memleak.patch
new file mode 100644
index 00000000000..d7d41f976cc
--- /dev/null
+++ b/net-libs/libssh2/files/libssh2-1.8.0-openssl11-memleak.patch
@@ -0,0 +1,23 @@
+From 97518ca8bda91ce12c503197a98fa71690cb67f9 Mon Sep 17 00:00:00 2001
+From: Will Cosgrove <[email protected]>
+Date: Fri, 12 May 2017 16:34:26 -0700
+Subject: [PATCH] Fix memory leak of crypt_ctx->h using openSSL 1.1+ (#177)
+
+Need to use EVP_CIPHER_CTX_free instead of EVP_CIPHER_CTX_reset.
+---
+ src/openssl.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/openssl.h b/src/openssl.h
+index 6aa12192..2bd80b96 100644
+--- a/src/openssl.h
++++ b/src/openssl.h
+@@ -267,7 +267,7 @@ int _libssh2_md5_init(libssh2_md5_ctx *ctx);
+ #define _libssh2_cipher_3des EVP_des_ede3_cbc
+ 
+ #ifdef HAVE_OPAQUE_STRUCTS
+-#define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_reset(*(ctx))
++#define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_free(*(ctx))
+ #else
+ #define _libssh2_cipher_dtor(ctx) EVP_CIPHER_CTX_cleanup(ctx)
+ #endif

diff --git a/net-libs/libssh2/libssh2-1.8.0-r1.ebuild 
b/net-libs/libssh2/libssh2-1.8.0-r1.ebuild
index 1105b230b82..2e8c25a0743 100644
--- a/net-libs/libssh2/libssh2-1.8.0-r1.ebuild
+++ b/net-libs/libssh2/libssh2-1.8.0-r1.ebuild
@@ -27,6 +27,7 @@ PATCHES=(
        "${FILESDIR}"/${PN}-1.8.0-libgcrypt-prefix.patch
        "${FILESDIR}"/${PN}-1.8.0-mansyntax_sh.patch
        "${FILESDIR}"/${PN}-1.8.0-openssl11.patch
+       "${FILESDIR}"/${PN}-1.8.0-openssl11-memleak.patch
 )
 
 multilib_src_configure() {

Reply via email to