Bug 819825, fix ICE/STUN crash on Android by null-checking setlocale(), r=abr

This commit is contained in:
Dan Mosedale 2012-12-13 16:52:52 -08:00
Родитель 1f48f84d13
Коммит 48a25bac31
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -91,9 +91,11 @@ mbslen(const char *s, size_t *ncharsp)
if (!strstr(my_locale, "UTF-8"))
ABORT(R_NOT_FOUND);
#else
/* can't count UTF-8 characters with mbrlen if the locale isn't UTF-8 */
if (! strcasestr(setlocale(LC_CTYPE, 0), "UTF-8"))
ABORT(R_NOT_FOUND);
/* can't count UTF-8 characters with mbrlen if the locale isn't UTF-8 */
/* null-checking setlocale is required because Android */
char *locale = setlocale(LC_CTYPE, 0);
if (!locale || !strcasestr(locale, "UTF-8"))
ABORT(R_NOT_FOUND);
#endif
#ifdef DARWIN