From: Moriyoshi Koizumi Date: Sat, 2 Aug 2008 20:48:30 +0000 (+0000) Subject: - Fixed bug #45691 (Some per-dir or runtime settings may leak into other requests). X-Git-Tag: BEFORE_HEAD_NS_CHANGE~901 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=51180a707c7572ee15395935d15451c09a69f0b9;p=php - Fixed bug #45691 (Some per-dir or runtime settings may leak into other requests). --- diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index b104b46626..7ce4de52c4 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1013,6 +1013,7 @@ static PHP_INI_MH(OnUpdate_mbstring_language) no_language = mbfl_name2no_language(new_value); if (no_language == mbfl_no_language_invalid) { + MBSTRG(language) = mbfl_no_language_neutral; return FAILURE; } MBSTRG(language) = no_language; @@ -1028,12 +1029,16 @@ static PHP_INI_MH(OnUpdate_mbstring_detect_order) int size; if (php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) { - if (MBSTRG(detect_order_list) != NULL) { + if (MBSTRG(detect_order_list)) { free(MBSTRG(detect_order_list)); } MBSTRG(detect_order_list) = list; MBSTRG(detect_order_list_size) = size; } else { + if (MBSTRG(detect_order_list)) { + free(MBSTRG(detect_order_list)); + MBSTRG(detect_order_list) = NULL; + } return FAILURE; } @@ -1048,12 +1053,17 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input) int size; if (php_mb_parse_encoding_list(new_value, new_value_length, &list, &size, 1 TSRMLS_CC)) { - if (MBSTRG(http_input_list) != NULL) { + if (MBSTRG(http_input_list)) { free(MBSTRG(http_input_list)); } MBSTRG(http_input_list) = list; MBSTRG(http_input_list_size) = size; } else { + if (MBSTRG(http_input_list)) { + free(MBSTRG(http_input_list)); + MBSTRG(http_input_list) = NULL; + } + MBSTRG(http_input_list_size) = 0; return FAILURE; } @@ -1071,6 +1081,8 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output) MBSTRG(http_output_encoding) = no_encoding; MBSTRG(current_http_output_encoding) = no_encoding; } else { + MBSTRG(http_output_encoding) = mbfl_no_encoding_pass; + MBSTRG(current_http_output_encoding) = mbfl_no_encoding_pass; if (new_value != NULL && new_value_length > 0) { return FAILURE; } @@ -1084,34 +1096,75 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output) static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) { enum mbfl_no_encoding no_encoding; - if (new_value == NULL) { - return SUCCESS; - } - - no_encoding = mbfl_name2no_encoding(new_value); + const char *enc_name = NULL; + uint enc_name_len = 0; + + no_encoding = new_value ? mbfl_name2no_encoding(new_value): + mbfl_no_encoding_invalid; if (no_encoding != mbfl_no_encoding_invalid) { - MBSTRG(internal_encoding) = no_encoding; - MBSTRG(current_internal_encoding) = no_encoding; + enc_name = new_value; + enc_name_len = new_value_length; + } else { + switch (MBSTRG(language)) { + case mbfl_no_language_uni: + enc_name = "UTF-8"; + enc_name_len = sizeof("UTF-8") - 1; + break; + case mbfl_no_language_japanese: + enc_name = "EUC-JP"; + enc_name_len = sizeof("EUC-JP") - 1; + break; + case mbfl_no_language_korean: + enc_name = "EUC-KR"; + enc_name_len = sizeof("EUC-KR") - 1; + break; + case mbfl_no_language_simplified_chinese: + enc_name = "EUC-CN"; + enc_name_len = sizeof("EUC-CN") - 1; + break; + case mbfl_no_language_traditional_chinese: + enc_name = "EUC-TW"; + enc_name_len = sizeof("EUC-TW") - 1; + break; + case mbfl_no_language_russian: + enc_name = "KOI8-R"; + enc_name_len = sizeof("KOI8-R") - 1; + break; + case mbfl_no_language_german: + enc_name = "ISO-8859-15"; + enc_name_len = sizeof("ISO-8859-15") - 1; + break; + case mbfl_no_language_armenian: + enc_name = "ArmSCII-8"; + enc_name_len = sizeof("ArmSCII-8") - 1; + break; + case mbfl_no_language_turkish: + enc_name = "ISO-8859-9"; + enc_name_len = sizeof("ISO-8859-9") - 1; + break; + default: + enc_name = "ISO-8859-1"; + enc_name_len = sizeof("ISO-8859-1") - 1; + break; + } + no_encoding = mbfl_name2no_encoding(enc_name); + } + MBSTRG(internal_encoding) = no_encoding; + MBSTRG(current_internal_encoding) = no_encoding; #if HAVE_MBREGEX - { - const char *enc_name = new_value; - if (FAILURE == php_mb_regex_set_default_mbctype(enc_name TSRMLS_CC)) { - /* falls back to EUC-JP if an unknown encoding name is given */ - enc_name = "EUC-JP"; - php_mb_regex_set_default_mbctype(enc_name TSRMLS_CC); - } - php_mb_regex_set_mbctype(new_value TSRMLS_CC); + { + const char *_enc_name = enc_name; + if (FAILURE == php_mb_regex_set_default_mbctype(_enc_name TSRMLS_CC)) { + /* falls back to EUC-JP if an unknown encoding name is given */ + _enc_name = "EUC-JP"; + php_mb_regex_set_default_mbctype(_enc_name TSRMLS_CC); } + php_mb_regex_set_mbctype(_enc_name TSRMLS_CC); + } #endif #ifdef ZEND_MULTIBYTE - zend_multibyte_set_internal_encoding(new_value, new_value_length TSRMLS_CC); + zend_multibyte_set_internal_encoding(new_value, new_value_length TSRMLS_CC); #endif /* ZEND_MULTIBYTE */ - } else { - if (new_value != NULL && new_value_length > 0) { - return FAILURE; - } - } - return SUCCESS; } /* }}} */ @@ -1129,6 +1182,11 @@ static PHP_INI_MH(OnUpdate_mbstring_script_encoding) MBSTRG(script_encoding_list) = list; MBSTRG(script_encoding_list_size) = size; } else { + if (MBSTRG(script_encoding_list) != NULL) { + free(MBSTRG(script_encoding_list)); + } + MBSTRG(script_encoding_list) = NULL; + MBSTRG(script_encoding_list_size) = 0; return FAILURE; } @@ -1224,7 +1282,7 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes) /* {{{ php.ini directive registration */ PHP_INI_BEGIN() - PHP_INI_ENTRY("mbstring.language", "neutral", PHP_INI_SYSTEM | PHP_INI_PERDIR, OnUpdate_mbstring_language) + PHP_INI_ENTRY("mbstring.language", "neutral", PHP_INI_ALL, OnUpdate_mbstring_language) PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order) PHP_INI_ENTRY("mbstring.http_input", "pass", PHP_INI_ALL, OnUpdate_mbstring_http_input) PHP_INI_ENTRY("mbstring.http_output", "pass", PHP_INI_ALL, OnUpdate_mbstring_http_output) @@ -1262,7 +1320,6 @@ PHP_INI_END() static PHP_GINIT_FUNCTION(mbstring) { mbstring_globals->language = mbfl_no_language_uni; - mbstring_globals->current_language = mbstring_globals->language; mbstring_globals->internal_encoding = mbfl_no_encoding_invalid; mbstring_globals->current_internal_encoding = mbstring_globals->internal_encoding; #ifdef ZEND_MULTIBYTE @@ -1373,53 +1430,9 @@ PHP_RINIT_FUNCTION(mbstring) zend_function *func, *orig; const struct mb_overload_def *p; - MBSTRG(current_language) = MBSTRG(language); php_mb_nls_get_default_detect_order_list(MBSTRG(language), &MBSTRG(default_detect_order_list), &MBSTRG(default_detect_order_list_size)); - if (MBSTRG(internal_encoding) == mbfl_no_encoding_invalid) { - char *default_enc = NULL; - switch (MBSTRG(current_language)) { - case mbfl_no_language_uni: - default_enc = "UTF-8"; - break; - case mbfl_no_language_japanese: - default_enc = "EUC-JP"; - break; - case mbfl_no_language_korean: - default_enc = "EUC-KR"; - break; - case mbfl_no_language_simplified_chinese: - default_enc = "EUC-CN"; - break; - case mbfl_no_language_traditional_chinese: - default_enc = "EUC-TW"; - break; - case mbfl_no_language_russian: - default_enc = "KOI8-R"; - break; - case mbfl_no_language_german: - default_enc = "ISO-8859-15"; - break; - case mbfl_no_language_armenian: - default_enc = "ArmSCII-8"; - break; - case mbfl_no_language_turkish: - default_enc = "ISO-8859-9"; - break; - case mbfl_no_language_english: - default: - default_enc = "ISO-8859-1"; - break; - } - if (default_enc) { - zend_alter_ini_entry("mbstring.internal_encoding", - sizeof("mbstring.internal_encoding"), - default_enc, strlen(default_enc), - PHP_INI_PERDIR, PHP_INI_STAGE_RUNTIME); - } - } - MBSTRG(current_internal_encoding) = MBSTRG(internal_encoding); MBSTRG(current_http_output_encoding) = MBSTRG(http_output_encoding); MBSTRG(current_filter_illegal_mode) = MBSTRG(filter_illegal_mode); @@ -1558,22 +1571,20 @@ PHP_FUNCTION(mb_language) { char *name = NULL; int name_len = 0; - enum mbfl_no_language no_language; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &name, &name_len) == FAILURE) { return; } if (name == NULL) { - RETURN_STRING((char *)mbfl_no_language2name(MBSTRG(current_language)), 1); + RETVAL_STRING((char *)mbfl_no_language2name(MBSTRG(language)), 1); } else { - no_language = mbfl_name2no_language(name); - if (no_language == mbfl_no_language_invalid) { + if (FAILURE == zend_alter_ini_entry( + "mbstring.language", sizeof("mbstring.language"), + name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown language \"%s\"", name); - RETURN_FALSE; + RETVAL_FALSE; } else { - php_mb_nls_get_default_detect_order_list(no_language, &MBSTRG(default_detect_order_list), &MBSTRG(default_detect_order_list_size)); - MBSTRG(current_language) = no_language; - RETURN_TRUE; + RETVAL_TRUE; } } } @@ -1922,10 +1933,10 @@ PHP_FUNCTION(mb_parse_str) info.separator = PG(arg_separator).input; info.report_errors = 1; info.to_encoding = MBSTRG(current_internal_encoding); - info.to_language = MBSTRG(current_language); + info.to_language = MBSTRG(language); info.from_encodings = MBSTRG(http_input_list); info.num_from_encodings = MBSTRG(http_input_list_size); - info.from_language = MBSTRG(current_language); + info.from_language = MBSTRG(language); detected = _php_mb_encoding_handler_ex(&info, track_vars_array, encstr TSRMLS_CC); @@ -2016,7 +2027,7 @@ PHP_FUNCTION(mb_output_handler) /* feed the string */ mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); string.val = (unsigned char *)arg_string; string.len = arg_string_len; @@ -2052,7 +2063,7 @@ PHP_FUNCTION(mb_strlen) RETURN_FALSE; } - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); if (enc_name == NULL) { string.no_encoding = MBSTRG(current_internal_encoding); } else { @@ -2084,9 +2095,9 @@ PHP_FUNCTION(mb_strpos) mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(current_language); + haystack.no_language = MBSTRG(language); haystack.no_encoding = MBSTRG(current_internal_encoding); - needle.no_language = MBSTRG(current_language); + needle.no_language = MBSTRG(language); needle.no_encoding = MBSTRG(current_internal_encoding); offset = 0; @@ -2151,9 +2162,9 @@ PHP_FUNCTION(mb_strrpos) mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(current_language); + haystack.no_language = MBSTRG(language); haystack.no_encoding = MBSTRG(current_internal_encoding); - needle.no_language = MBSTRG(current_language); + needle.no_language = MBSTRG(language); needle.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|Zs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &zoffset, &enc_name, &enc_name_len) == FAILURE) { @@ -2295,9 +2306,9 @@ PHP_FUNCTION(mb_strstr) mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(current_language); + haystack.no_language = MBSTRG(language); haystack.no_encoding = MBSTRG(current_internal_encoding); - needle.no_language = MBSTRG(current_language); + needle.no_language = MBSTRG(language); needle.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|bs", (char **)&haystack.val, (int *)&haystack.len, (char **)&needle.val, (int *)&needle.len, &part, &enc_name, &enc_name_len) == FAILURE) { @@ -2353,9 +2364,9 @@ PHP_FUNCTION(mb_strrchr) mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(current_language); + haystack.no_language = MBSTRG(language); haystack.no_encoding = MBSTRG(current_internal_encoding); - needle.no_language = MBSTRG(current_language); + needle.no_language = MBSTRG(language); needle.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|bs", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &part, &enc_name, &enc_name_len) == FAILURE) { @@ -2411,9 +2422,9 @@ PHP_FUNCTION(mb_stristr) const char *from_encoding = mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(current_language); + haystack.no_language = MBSTRG(language); haystack.no_encoding = MBSTRG(current_internal_encoding); - needle.no_language = MBSTRG(current_language); + needle.no_language = MBSTRG(language); needle.no_encoding = MBSTRG(current_internal_encoding); @@ -2469,9 +2480,9 @@ PHP_FUNCTION(mb_strrichr) char *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding)); mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(current_language); + haystack.no_language = MBSTRG(language); haystack.no_encoding = MBSTRG(current_internal_encoding); - needle.no_language = MBSTRG(current_language); + needle.no_language = MBSTRG(language); needle.no_encoding = MBSTRG(current_internal_encoding); @@ -2523,9 +2534,9 @@ PHP_FUNCTION(mb_substr_count) mbfl_string_init(&haystack); mbfl_string_init(&needle); - haystack.no_language = MBSTRG(current_language); + haystack.no_language = MBSTRG(language); haystack.no_encoding = MBSTRG(current_internal_encoding); - needle.no_language = MBSTRG(current_language); + needle.no_language = MBSTRG(language); needle.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|s", (char **)&haystack.val, &haystack.len, (char **)&needle.val, &needle.len, &enc_name, &enc_name_len) == FAILURE) { @@ -2569,7 +2580,7 @@ PHP_FUNCTION(mb_substr) } mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); if (argc == 4) { @@ -2638,7 +2649,7 @@ PHP_FUNCTION(mb_strcut) mbfl_string string, result, *ret; mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|ls", (char **)&string.val, (int **)&string.len, &from, &len, &encoding, &encoding_len) == FAILURE) { @@ -2705,7 +2716,7 @@ PHP_FUNCTION(mb_strwidth) mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", (char **)&string.val, &string.len, &enc_name, &enc_name_len) == FAILURE) { @@ -2744,9 +2755,9 @@ PHP_FUNCTION(mb_strimwidth) mbfl_string_init(&string); mbfl_string_init(&marker); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); - marker.no_language = MBSTRG(current_language); + marker.no_language = MBSTRG(language); marker.no_encoding = MBSTRG(current_internal_encoding); marker.val = NULL; marker.len = 0; @@ -2818,7 +2829,7 @@ MBSTRING_API char * php_mb_convert_encoding(const char *input, size_t length, co mbfl_string_init(&result); from_encoding = MBSTRG(current_internal_encoding); string.no_encoding = from_encoding; - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.val = (unsigned char *)input; string.len = length; @@ -3074,7 +3085,7 @@ PHP_FUNCTION(mb_detect_encoding) } mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.val = (unsigned char *)str; string.len = str_len; ret = mbfl_identify_encoding_name(&string, elist, size, strict); @@ -3261,7 +3272,7 @@ PHP_FUNCTION(mb_encode_mimeheader) long indent = 0; mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sssl", (char **)&string.val, &string.len, &charset_name, &charset_name_len, &trans_enc_name, &trans_enc_name_len, &linefeed, &linefeed_len, &indent) == FAILURE) { @@ -3278,7 +3289,7 @@ PHP_FUNCTION(mb_encode_mimeheader) RETURN_FALSE; } } else { - const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); + const mbfl_language *lang = mbfl_no2language(MBSTRG(language)); if (lang != NULL) { charset = lang->mail_charset; transenc = lang->mail_header_encoding; @@ -3310,7 +3321,7 @@ PHP_FUNCTION(mb_decode_mimeheader) mbfl_string string, result, *ret; mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", (char **)&string.val, &string.len) == FAILURE) { @@ -3339,7 +3350,7 @@ PHP_FUNCTION(mb_convert_kana) int encname_len; mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ss", (char **)&string.val, &string.len, &optstr, &optstr_len, &encname, &encname_len) == FAILURE) { @@ -3471,7 +3482,7 @@ PHP_FUNCTION(mb_convert_variables) mbfl_string_init(&result); from_encoding = MBSTRG(current_internal_encoding); string.no_encoding = from_encoding; - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); /* pre-conversion encoding */ elist = NULL; @@ -3674,7 +3685,7 @@ php_mb_numericentity_exec(INTERNAL_FUNCTION_PARAMETERS, int type) } mbfl_string_init(&string); - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.no_encoding = MBSTRG(current_internal_encoding); string.val = (unsigned char *)str; string.len = str_len; @@ -4007,7 +4018,7 @@ PHP_FUNCTION(mb_send_mail) tran_cs = mbfl_no_encoding_utf8; head_enc = mbfl_no_encoding_base64; body_enc = mbfl_no_encoding_base64; - lang = mbfl_no2language(MBSTRG(current_language)); + lang = mbfl_no2language(MBSTRG(language)); if (lang != NULL) { tran_cs = lang->mail_charset; head_enc = lang->mail_header_encoding; @@ -4125,7 +4136,7 @@ PHP_FUNCTION(mb_send_mail) /* Subject: */ if (subject != NULL && subject_len >= 0) { - orig_str.no_language = MBSTRG(current_language); + orig_str.no_language = MBSTRG(language); orig_str.val = (unsigned char *)subject; orig_str.len = subject_len; orig_str.no_encoding = MBSTRG(current_internal_encoding); @@ -4144,7 +4155,7 @@ PHP_FUNCTION(mb_send_mail) /* message body */ if (message != NULL) { - orig_str.no_language = MBSTRG(current_language); + orig_str.no_language = MBSTRG(language); orig_str.val = (unsigned char *)message; orig_str.len = (unsigned int)message_len; orig_str.no_encoding = MBSTRG(current_internal_encoding); @@ -4261,7 +4272,7 @@ PHP_FUNCTION(mb_get_info) char *name; const struct mb_overload_def *over_func; zval *row1, *row2; - const mbfl_language *lang = mbfl_no2language(MBSTRG(current_language)); + const mbfl_language *lang = mbfl_no2language(MBSTRG(language)); enum mbfl_no_encoding *entry; #ifdef ZEND_MULTIBYTE zval *row3; @@ -4314,7 +4325,7 @@ PHP_FUNCTION(mb_get_info) } else { add_assoc_string(return_value, "encoding_translation", "Off", 1); } - if ((name = (char *)mbfl_no_language2name(MBSTRG(current_language))) != NULL) { + if ((name = (char *)mbfl_no_language2name(MBSTRG(language))) != NULL) { add_assoc_string(return_value, "language", name, 1); } n = MBSTRG(current_detect_order_list_size); @@ -4409,7 +4420,7 @@ PHP_FUNCTION(mb_get_info) RETVAL_STRING("Off", 1); } } else if (!strcasecmp("language", typ)) { - if ((name = (char *)mbfl_no_language2name(MBSTRG(current_language))) != NULL) { + if ((name = (char *)mbfl_no_language2name(MBSTRG(language))) != NULL) { RETVAL_STRING(name, 1); } } else if (!strcasecmp("detect_order", typ)) { @@ -4507,7 +4518,7 @@ PHP_FUNCTION(mb_check_encoding) mbfl_string_init(&string); mbfl_string_init(&result); string.no_encoding = no_encoding; - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); string.val = (unsigned char *)var; string.len = var_len; @@ -4669,7 +4680,7 @@ MBSTRING_API int php_mb_gpc_encoding_converter(char **str, int *len, int num, co mbfl_string_init(&string); mbfl_string_init(&result); string.no_encoding = from_encoding; - string.no_language = MBSTRG(current_language); + string.no_language = MBSTRG(language); for (i=0; i