Re: [PATCH 2/2] msvcp90: Copy name in _Getctype (Valgrind) (try2)
On 06/24/15 16:46, Daniel Lehman wrote:
+ name = ___lc_locale_name_func()[LC_COLLATE]; + size = wcslen(name)+1; + ret->name = malloc(size*sizeof(*name)); + if (!ret->name) throw_exception(EXCEPTION_BAD_ALLOC, NULL); + memcpy(ret->name, name, size*sizeof(*name)); This will not work if ___lc_locale_name_func()[LC_COLLATE] is NULL.
Thanks, Piotr
On 06/24/15 16:46, Daniel Lehman wrote:
+ name = ___lc_locale_name_func()[LC_COLLATE]; + size = wcslen(name)+1; + ret->name = malloc(size*sizeof(*name)); + if (!ret->name) throw_exception(EXCEPTION_BAD_ALLOC, NULL); + memcpy(ret->name, name, size*sizeof(*name)); This will not work if ___lc_locale_name_func()[LC_COLLATE] is NULL.
I updated the patch to check for NULL. But wouldn't the same be true for these calls? - _Getdateorder -> GetLocaleInfoEx - _Strcoll -> LocaleNameToLCID -> parse_locale_name Thanks daniel
On 06/26/15 16:37, Daniel Lehman wrote:
I updated the patch to check for NULL. But wouldn't the same be true for these calls? - _Getdateorder -> GetLocaleInfoEx - _Strcoll -> LocaleNameToLCID -> parse_locale_name This calls are correct because LOCALE_NAME_USER_DEFAULT equals NULL. In case of e.g. C locale default user LCID will be used.
Thanks, Piotr
participants (2)
-
Daniel Lehman -
Piotr Caban