* UTF-16 uses at least two bytes, growing up to four bytes as necessary,
* that is why we multiply UChar by 4.
*/
- char _text[4*ulen+1];
+ char *_text = NULL;
+ _text = (char *)malloc(4 * ulen + 1);
+ retv_if(_text == NULL, I18N_ERROR_OUT_OF_MEMORY);
+ memset(_text, 0x0, 4 * ulen + 1);
+
u_austrcpy(_text, _ubidi_text);
int32_t len = strlen(_text);
*text = (char *)malloc(len + 1);
retv_if(*text == NULL, I18N_ERROR_OUT_OF_MEMORY);
+ memset(*text, 0x0, len+1);
strncpy(*text, _text, len);
int i18n_ubidi_invert_map(const int32_t *scr_map, int32_t length, int32_t *dest_map)
{
- retv_if(scr_map == NULL || dest_map == NULL, I18N_ERROR_INVALID_PARAMETER);
+ retv_if(scr_map == NULL || dest_map == NULL || length <= 0, I18N_ERROR_INVALID_PARAMETER);
ubidi_invertMap(scr_map, dest_map, length);