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

Jacek Caban jacek at codeweavers.com
Sat Dec 20 10:38:44 CST 2008

Hi Andrew,

Andrew Talbot wrote:
> Jacek Caban wrote:
>> 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
> Hi Jacek,
> Technically, behavior is undefined if the pointers do not each point to an
> object, even if the size parameter has a value of zero (see
> http://tinyurl.com/6eqo3n, third post). Though I concede that it would be a
> rare implementation that touched its pointers (or copies of them) in that
> case.

I'm not fan of such fixes, but if you want to fix it, you should check 
len, not str, in your patch and you may move zero-terminating outside 
if..else statement.


More information about the wine-devel mailing list