jscript: Do not call memcpy() with a NULL pointer argument

Jacek Caban jacek at codeweavers.com
Fri Dec 19 08:49:48 CST 2008


Andrew Talbot wrote:
> On Thu Dec 18 22:41 , 'James Hawkins' <truiken at gmail.com> sent:
>
>   
>> I didn't write jscript, so I'm not the expert, but create_string is
>> internal, so we should probably crash if str is NULL instead of hiding
>> the error.  What is this patch for?
>>
>> -- 
>> James Hawkins
>>     
>
> Hi James,
>
> create_string() is called on line 1323 of this file, with str == NULL and
> len = 0. This function always allocates memory for at least one one WCHAR,
> so I zero-terminated it.
>   

The string was always zero-terminated without your patch. It's fine to 
call create_string with NULL str argument as long as len is 0 and 
current implementation works fine in this case.


Jacek



More information about the wine-devel mailing list