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>] [day] [month] [year] [list]
Message-Id: <1421877092-25435-1-git-send-email-linux@roeck-us.net>
Date:	Wed, 21 Jan 2015 13:51:32 -0800
From:	Guenter Roeck <linux@...ck-us.net>
To:	Alexander Viro <viro@...iv.linux.org.uk>
Cc:	Sabrina Dubroca <sd@...asysnail.net>,
	Paul Moore <pmoore@...hat.com>, inux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, Guenter Roeck <linux@...ck-us.net>
Subject: [PATCH] fs: namei: Use memcpy instead of strlcpy

If the string length is known, there is no need to use strlcpy.
Use memcpy instead.

Signed-off-by: Guenter Roeck <linux@...ck-us.net>
---
Nitpick, but still a bit faster. Applies on top of -next.

 fs/namei.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/namei.c b/fs/namei.c
index 323957f..2e09219 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -233,7 +233,7 @@ getname_kernel(const char * filename)
 		__putname(result);
 		return ERR_PTR(-ENAMETOOLONG);
 	}
-	strlcpy((char *)result->name, filename, len);
+	memcpy((char *)result->name, filename, len);
 	result->uptr = NULL;
 	result->aname = NULL;
 	result->refcnt = 1;
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ