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:	Thu, 2 Aug 2007 22:09:02 +0100
From:	Al Viro <viro@....linux.org.uk>
To:	Guennadi Liakhovetski <g.liakhovetski@....de>
Cc:	linux-kernel@...r.kernel.org
Subject: Re: gcc fixed size char array initialization bug - known?

On Thu, Aug 02, 2007 at 10:26:37PM +0200, Guennadi Liakhovetski wrote:
> 
> Worse yet, K&R explicitely writes:
> 
> <quote>
> 
> 	char pattern[] = "ould";
> 
> is a shorthand for the longer but equivalent
> 
> 	char pattern[] = { 'o', 'u', 'l', 'd', '\0' };
> 
> </quote>
> 
> In the latter spelling gcc < 4.2 DOES warn too.

Does warn for what?  Array with known size?  Sure, so it should - you
have excess initializer list elements.

Note the [] in the quoted - it does matter.

Again, it's perfectly legitimate to use string literal to initialize
any kind of array of character type.  \0 goes there only if there's
space for it; if array size is unknown, the space is left.  That's it.
-
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