shlwapi: Resupply array sizes stripped by function interface

Mikołaj Zalewski mikolaj at zalewski.pl
Tue Sep 26 17:28:51 CDT 2006


Andrew Talbot wrote:

>I am about to submit another try, to see what people think. This time I'm
>using GetLocaleInfoW() twice for each buffer: once, to determine the size
>needed, and again, to actually get the locale info.
>  
>
  I'm afraid this is worse than it was - if a separator will happen to 
be longer than 7 characters plus NUL you will write part the end of the 
buffer (the buffers in FormatInt and FormatDouble are 8 characters 
long). If you really want to support strings of any length you should 
allocate the buffer dynamically. But IMHO that would be a wait of time 
for you and the CPU executing such code. I'd expect #defining a constant 
for the 8 as the buffer length should be enough.
  As for the changelog entry I'm not an expert but maybe "shlwapi: 
bugfix: sizeof(array passed as a parameter) can't be used to count it's 
elements" would be better?

Mikolaj Zalewski



More information about the wine-devel mailing list