[PATCH] shell32: use flexible arrays to avoid fortify failures

James McKenzie jjmckenzie51 at earthlink.net
Sun Sep 19 16:01:52 CDT 2010


  On 9/19/10 11:53 AM, Mike Frysinger wrote:
> On Sunday, September 19, 2010 08:58:42 Alexandre Julliard wrote:
>> Mike Frysinger writes:
>>> Newer versions of gcc/glibc with fortify checks enabled will complain
>>> about the handling of the network's szNames field.  Currently it is
>>> always defined with a length of one which means writing more then a
>>>
>>> single byte will trigger:
>>> 	In function 'strcpy', inlined from '_ILCreateEntireNetwork' at
>>> 	dlls/shell32/pidl.c:1762:15:
>>> 	warning: call to __builtin___strcpy_chk will always overflow destination
>>> 	buffer
>>>
>>> and then at runtime, we hit an abort().
>>>
>>> Since this field is really serving as the header to an arbitrary buffer,
>>> using a flexible array instead should solve the issue.
>> What you want is ANYSIZE_ARRAY, which already exists.
> i dont see how that would help.  the code is currently:
> typedef struct ... {
> 	...
> 	CHAR foo[1];
> } ...;
>
> it needs to be "foo[]".
Just a question to satisfy my curiousity:

Is this supported in C89 code?  If not, then the char[1] has to remain 
because the code level is C89.

http://wiki.winehq.org/SubmittingPatches#head-7a578af49f1d1ab7f36f4b1f98b7544bb55eea9a

States to avoid C++, C99, and non-portable C constructs.

James McKenzie
Just a Humble Reader, not a true developer






More information about the wine-devel mailing list