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: <5adf51cc1df72cfd261e3c6e7bead312@kernel.crashing.org>
Date:	Thu, 6 Mar 2008 16:44:24 +0100
From:	Segher Boessenkool <segher@...nel.crashing.org>
To:	Roel Kluin <12o3l@...cali.nl>
Cc:	paulus@...ba.org, arnd@...db.de, linuxppc-dev@...abs.org,
	lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] PPC: in celleb_show_cpuinfo() convert strncpy(x, y, sizeof(x)) to strlcpy 

> This patch was not yet tested. Please confirm it's right.
> ---
> strncpy does not append '\0' if the length of the source string equals
> the size parameter, strlcpy does.

strlcpy() doesn't fill the rest of the array with zeroes, strncpy()
does.  This could matter (information leak, for example), although
I doubt it does here.

> -	strncpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
> +	strlcpy(celleb_machine_type, ptr, sizeof(celleb_machine_type));
>  	celleb_machine_type[sizeof(celleb_machine_type)-1] = 0;

That last statement makes the strncpy() case always zero-terminated,
so this patch isn't necessary.  Oh, and neither the old nor the new
code handles the case where the string doesn't fit (other than just
cutting it short); is that the wanted behaviour?


Segher

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