[PATCH v4] msvcrt: Don't crash if _vsnwprintf gets NULL as format string and add test

Piotr Caban piotr.caban at gmail.com
Mon Nov 27 07:20:05 CST 2017


Hi Fabian,

On 11/25/17 18:55, Fabian Maurer wrote:
> +void test__vsnwprintf(void)
> +{
> +    int ret;
> +    WCHAR str[2] = {0};
> +
> +    /* Test with format string set to NULL, we should not crash on vista or newer. */
> +    if(is_vista_or_newer())
Do you need this condition? I'm expecting msvcr90 behavior to be 
consistent between OS version.


> +    if(!fmt)
> +    {
> +        *MSVCRT__errno() = MSVCRT_EINVAL;
> +        MSVCRT__invalid_parameter(NULL, NULL, NULL, 0, 0);
> +        return -1;
> +    }
Please use MSVCRT_CHECK_PMT macro here.

Thanks,
Piotr



More information about the wine-devel mailing list