12 Aug
2016
12 Aug
'16
8:42 a.m.
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