[shlwapi] Add NULL checks to StrCpyW and StrCatW

carlo.bramix at libero.it carlo.bramix at libero.it
Mon Apr 16 15:23:54 CDT 2012


I updated the patch with improved tests into test_StrCpyW() as requested.

Sincerely,

Carlo Bramini.

>----Messaggio originale----
>Da: 00cpxxx at gmail.com
>Data: 15/04/2012 5.09
>A: "carlo.bramix at libero.it"<carlo.bramix at libero.it>
>Ogg: Re: [shlwapi] Add NULL checks to StrCpyW and StrCatW
>
>You probably will need to add tests to prove this behavior.
>
>Best wishes,
>Bruno
>
>2012/4/14 carlo.bramix at libero.it <carlo.bramix at libero.it>:
>> From Bug #25261:
>>
>> I looked the terminal output in the attachment of this bug and then I did 
some
>> debugging on Windows.
>> I tested StrCpyW and also StrCatW (my intuition suggested me to do so) and 
I
>> discovered that:
>>
>> StrCpyW(myDestination, mySource) does not crash, it copies the content of
>> mySource into myDestination, pointer to myDestination is returned.
>>
>> StrCpyW(myDestination, NULL) does not crash, it leaves myDestination
>> unchanged, pointer to myDestination is returned.
>>
>> StrCpyW(NULL, NULL) does not crash, it returns NULL.
>>
>> StrCatW has the same behavior of StrCpyW.
>> Actually, it seems to me that many string functions implemented into 
shlwapi
>> are already protected against wrong parameters, evidently StrCpyW and 
StrCatW
>> have need the same fixes that have been made elsewhere, since strcpyW and
>> strcatW don't do it.
>> Attached patch should fix the defect, it just adds the test if both 
parameters
>> are not NULL before proceeding to the copy.
>>
>> Sincerely,
>>
>> Carlo Bramini.
>>
>>
>>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: string.txt
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20120416/6e777b50/attachment.txt>


More information about the wine-patches mailing list