oleaut32: do not crash in logging if string is NULL
Aric Stewart
aric at codeweavers.com
Wed Jan 20 09:41:17 CST 2010
Meaning the place where I am finding this is different bug?
In deserialize_param in the VT_BSTR case if the byte_length of the BSTR
that we are deserializing is -1 then BSTR_UserUnmarshal places NULL
into *arg.
I will admit I know very little about this code but having it crash when
trying to log seemed very wrong.
Should I change the
if (debugout) TRACE_(olerelay)("%s",relaystr(*(BSTR *)arg));
to a simple debugstr_w or is this revealing a deeper problem somewhere?
thanks,
-aric
Alexandre Julliard wrote:
> Aric Stewart <aric at codeweavers.com> writes:
>
>> @@ -68,10 +68,16 @@ typedef struct _marshal_state {
>>
>> /* used in the olerelay code to avoid having the L"" stuff added by debugstr_w */
>> static char *relaystr(WCHAR *in) {
>> - char *tmp = (char *)debugstr_w(in);
>> - tmp += 2;
>> - tmp[strlen(tmp)-1] = '\0';
>> - return tmp;
>> + static char szNull[] = "<NULL>";
>> + if (in)
>> + {
>> + char *tmp = (char *)debugstr_w(in);
>> + tmp += 2;
>> + tmp[strlen(tmp)-1] = '\0';
>> + return tmp;
>> + }
>> + else
>> + return szNull;
>> }
>
> This should never happen. Places that can get a null pointer should use
> the standard debugstr_w.
>
More information about the wine-devel
mailing list