[PATCH] msvcrt: Add _wcreate_locale

Piotr Caban piotr at codeweavers.com
Fri Aug 12 03:42:00 CDT 2016


On 08/11/16 19:27, Daniel Lehman wrote:
> +    len = MSVCRT_wcstombs(NULL, locale, 0);
> +    if (!(str = MSVCRT_malloc(len))) return NULL;
Please handle string conversion error. The allocated buffer is not big 
enough. Something like this should work:
len = MSVCRT_wcstombs(NULL, locale, 0);
if(len == -1) {
     ...
}
if(!(str = MSVCRT_malloc(len+1)) ...

It may be even better to call wcstombs_s so invalid parameter handler is 
called (I didn't test if it should be called).

Thanks,
Piotr



More information about the wine-devel mailing list