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]
Date:   Tue, 12 Dec 2017 17:36:39 +0800
From:   Ma Shimiao <mashimiao.fnst@...fujitsu.com>
To:     <hch@....de>, <sagi@...mberg.me>
CC:     <linux-kernel@...r.kernel.org>, <linux-nvme@...ts.infradead.org>,
        Ma Shimiao <mashimiao.fnst@...fujitsu.com>
Subject: [PATCH] drviers/nvme/target: fix max dup length for kstrndup

If source string longer than max, kstrndup will alloc max+1 space.
So, we should make sure the result will not over limit.

Signed-off-by: Ma Shimiao <mashimiao.fnst@...fujitsu.com>
---
 drivers/nvme/target/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index b54748ad5f48..0ca259ee4dea 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -975,7 +975,7 @@ struct nvmet_subsys *nvmet_subsys_alloc(const char *subsysnqn,
 		return NULL;
 	}
 	subsys->type = type;
-	subsys->subsysnqn = kstrndup(subsysnqn, NVMF_NQN_SIZE,
+	subsys->subsysnqn = kstrndup(subsysnqn, NVMF_NQN_SIZE - 1,
 			GFP_KERNEL);
 	if (!subsys->subsysnqn) {
 		kfree(subsys);
-- 
2.13.6



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ