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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 16 Sep 2014 08:40:57 +0000
From:	David Laight <David.Laight@...LAB.COM>
To:	'Rickard Strandqvist' <rickard_strandqvist@...ctrumdigital.se>
CC:	Marc Kleine-Budde <mkl@...gutronix.de>,
	Wolfgang Grandegger <wg@...ndegger.com>,
	Oliver Hartkopp <socketcan@...tkopp.net>,
	"Stephane Grosjean" <s.grosjean@...k-system.com>,
	Alexey Khoroshilov <khoroshilov@...ras.ru>,
	"Christopher R. Baker" <cbaker@....ri.cmu.edu>,
	"linux-can@...r.kernel.org" <linux-can@...r.kernel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] net: can: usb: peak_usb: pcan_usb_core.c: Cleaning up
 missing null-terminate in conjunction with strncpy

From: Rickard Strandqvist 
> > 2014-09-15 10:47 GMT+02:00 David Laight <David.Laight@...lab.com>:
...
> > Or:
> >     char name[sizeof netdev->name];
> >     memcpy(name, netdev->name, sizeof netdev->name);
> >
...
> I liked the variant:
> char name[sizeof(netdev->name)];
> 
> But dislike and do not understand what the point would be with memcpy variant.

The memcpy() will be a lot faster than any of the string copy functions
because it doesn't need to worry about the terminator.
In many cases it will be inlined to a short series of load and stores.

	David

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ