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: <20190730084018.26374-1-hslester96@gmail.com>
Date:   Tue, 30 Jul 2019 16:40:18 +0800
From:   Chuhong Yuan <hslester96@...il.com>
To:     unlisted-recipients:; (no To-header on input)
Cc:     Corentin Labbe <clabbe@...libre.com>,
        Herbert Xu <herbert@...dor.apana.org.au>,
        linux-kernel@...r.kernel.org, Chuhong Yuan <hslester96@...il.com>
Subject: [PATCH] crypto: tool: getstat: Fix unterminated strncpy

strncpy(dest, src, strlen(src)) leads to unterminated
dest, which is dangerous.
Fix it by using strscpy.

Signed-off-by: Chuhong Yuan <hslester96@...il.com>
---
 tools/crypto/getstat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/crypto/getstat.c b/tools/crypto/getstat.c
index 9e8ff76420fa..554ba08d9652 100644
--- a/tools/crypto/getstat.c
+++ b/tools/crypto/getstat.c
@@ -41,7 +41,7 @@ static int get_stat(const char *drivername)
 	req.n.nlmsg_type = CRYPTO_MSG_GETSTAT;
 	req.n.nlmsg_seq = time(NULL);
 
-	strncpy(req.cru.cru_driver_name, drivername, strlen(drivername));
+	strscpy(req.cru.cru_driver_name, drivername, strlen(drivername) + 1);
 
 	sd =  socket(AF_NETLINK, SOCK_RAW, NETLINK_CRYPTO);
 	if (sd < 0) {
-- 
2.20.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ