lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230525084324.56718-1-tianjia.zhang@linux.alibaba.com>
Date:   Thu, 25 May 2023 16:43:24 +0800
From:   Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
To:     Jarkko Sakkinen <jarkko@...nel.org>,
        David Howells <dhowells@...hat.com>,
        David Woodhouse <dwmw2@...radead.org>,
        keyrings@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
Subject: [PATCH] sign-file: fix memory leak

The buffer allocated by asprintf() must be freeed.

Signed-off-by: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
---
 scripts/sign-file.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/sign-file.c b/scripts/sign-file.c
index b90fc9f7437f..94267cf72197 100644
--- a/scripts/sign-file.c
+++ b/scripts/sign-file.c
@@ -369,6 +369,7 @@ int main(int argc, char **argv)
 			    "%s", sig_file_name);
 #endif
 			BIO_free(b);
+			free(sig_file_name);
 		}
 
 		if (sign_only) {
@@ -420,8 +421,10 @@ int main(int argc, char **argv)
 	ERR(BIO_free(bd) < 0, "%s", dest_name);
 
 	/* Finally, if we're signing in place, replace the original. */
-	if (replace_orig)
+	if (replace_orig) {
 		ERR(rename(dest_name, module_name) < 0, "%s", dest_name);
+		free(dest_name);
+	}
 
 	return 0;
 }
-- 
2.24.3 (Apple Git-128)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ