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]
Message-ID: <4644D779.30908@lsrfire.ath.cx>
Date:	Fri, 11 May 2007 22:52:09 +0200
From:	René Scharfe <rene.scharfe@...fire.ath.cx>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
CC:	Andi Kleen <ak@...e.de>, Andrew Morton <akpm@...ux-foundation.org>,
	lkml <linux-kernel@...r.kernel.org>,
	Chris Wright <chrisw@...s-sol.org>,
	Randy Dunlap <randy.dunlap@...cle.com>,
	YOSHIFUJI Hideaki <yoshfuji@...ux-ipv6.org>,
	Akinobu Mita <akinobu.mita@...il.com>,
	Arnaldo Carvalho de Melo <acme@...driva.com>,
	Al Viro <viro@....linux.org.uk>,
	Panagiotis Issaris <takis@...aris.org>
Subject: Re: [patch 3/7] add kstrndup

> +	len = strlen(s);
> +	if (len > max)
> +		len = max;

You can avoid to run beyond max and save two lines by using strnlen:

	len = strnlen(s, max);

René
-
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