bidi.c: Check buffer sizes.
This could cause a crash with certain themes and long filenames. Change-Id: I0a48c91bb089b122a56c4e126ba4d7a175399fa2
This commit is contained in:
parent
99f3f77ee8
commit
837cad0d38
1 changed files with 2 additions and 1 deletions
|
@ -144,6 +144,7 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation)
|
||||||
unsigned short *heb_str; /* *broken_str */
|
unsigned short *heb_str; /* *broken_str */
|
||||||
int block_start, block_end, block_type, block_length, i;
|
int block_start, block_end, block_type, block_length, i;
|
||||||
int length = utf8length(str);
|
int length = utf8length(str);
|
||||||
|
length=length>=SCROLL_LINE_SIZE?SCROLL_LINE_SIZE-1:length;
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
long max_chars=0;
|
long max_chars=0;
|
||||||
|
@ -152,7 +153,7 @@ unsigned short *bidi_l2v(const unsigned char *str, int orientation)
|
||||||
tmp = str;
|
tmp = str;
|
||||||
*/
|
*/
|
||||||
target = tmp = utf16_buf;
|
target = tmp = utf16_buf;
|
||||||
while (*str)
|
while (*str && target < &utf16_buf[SCROLL_LINE_SIZE-1])
|
||||||
str = utf8decode(str, target++);
|
str = utf8decode(str, target++);
|
||||||
*target = 0;
|
*target = 0;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue