oleaut32: do not crash in logging if string is NULL

Alexandre Julliard julliard at winehq.org
Wed Jan 20 09:32:59 CST 2010


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.

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list