mirror of
https://github.com/weechat/weechat.git
synced 2026-07-05 17:23:15 +02:00
Fixed 2 crashs: with malformed UTF-8 strings and with ncurses color when too many colors defined in ncurses
This commit is contained in:
@@ -4,6 +4,8 @@ WeeChat - Wee Enhanced Environment for Chat
|
||||
ChangeLog - 2006-05-14
|
||||
|
||||
Version 0.1.9 (under dev!):
|
||||
* fixed crash with malformed UTF-8 strings
|
||||
* fixed crash with ncurses color when too many colors defined in ncurses
|
||||
* added new key to find previous completion (shift-tab by default)
|
||||
* fixed bug with long outgoing IRC messages (> 512 bytes) (bug #16358)
|
||||
* fixed Ruby crash when handler does not return OK or KO (bug #16552)
|
||||
|
||||
+6
-6
@@ -65,7 +65,7 @@ utf8_init ()
|
||||
int
|
||||
utf8_is_valid (char *string)
|
||||
{
|
||||
while (string[0])
|
||||
while (string && string[0])
|
||||
{
|
||||
/* UTF-8, 2 bytes, should be: 110vvvvv 10vvvvvv */
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
@@ -219,7 +219,7 @@ utf8_strlen (char *string)
|
||||
return strlen (string);
|
||||
|
||||
length = 0;
|
||||
while (string[0])
|
||||
while (string && string[0])
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
length++;
|
||||
@@ -250,7 +250,7 @@ utf8_strnlen (char *string, int bytes)
|
||||
|
||||
start = string;
|
||||
length = 0;
|
||||
while (string[0] && (string - start < bytes))
|
||||
while (string && string[0] && (string - start < bytes))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
length++;
|
||||
@@ -306,7 +306,7 @@ utf8_add_offset (char *string, int offset)
|
||||
return string + offset;
|
||||
|
||||
count = 0;
|
||||
while (string[0] && (count < offset))
|
||||
while (string && string[0] && (count < offset))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
count++;
|
||||
@@ -330,7 +330,7 @@ utf8_real_pos (char *string, int pos)
|
||||
|
||||
count = 0;
|
||||
real_pos = 0;
|
||||
while (string[0] && (count < pos))
|
||||
while (string && string[0] && (count < pos))
|
||||
{
|
||||
next_char = utf8_next_char (string);
|
||||
real_pos += (next_char - string);
|
||||
@@ -356,7 +356,7 @@ utf8_pos (char *string, int real_pos)
|
||||
|
||||
count = 0;
|
||||
limit = string + real_pos;
|
||||
while (string[0] && (string < limit))
|
||||
while (string && string[0] && (string < limit))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
count++;
|
||||
|
||||
@@ -480,7 +480,7 @@ gui_color_init_pairs ()
|
||||
|
||||
if (has_colors ())
|
||||
{
|
||||
for (i = 1; i < COLOR_PAIRS; i++)
|
||||
for (i = 1; i < 64; i++)
|
||||
init_pair (i, shift_colors[i % 8], (i < 8) ? -1 : shift_colors[i / 8]);
|
||||
|
||||
/* disable white on white, replaced by black on white */
|
||||
|
||||
@@ -4,6 +4,8 @@ WeeChat - Wee Enhanced Environment for Chat
|
||||
ChangeLog - 2006-05-14
|
||||
|
||||
Version 0.1.9 (under dev!):
|
||||
* fixed crash with malformed UTF-8 strings
|
||||
* fixed crash with ncurses color when too many colors defined in ncurses
|
||||
* added new key to find previous completion (shift-tab by default)
|
||||
* fixed bug with long outgoing IRC messages (> 512 bytes) (bug #16358)
|
||||
* fixed Ruby crash when handler does not return OK or KO (bug #16552)
|
||||
|
||||
@@ -65,7 +65,7 @@ utf8_init ()
|
||||
int
|
||||
utf8_is_valid (char *string)
|
||||
{
|
||||
while (string[0])
|
||||
while (string && string[0])
|
||||
{
|
||||
/* UTF-8, 2 bytes, should be: 110vvvvv 10vvvvvv */
|
||||
if (((unsigned char)(string[0]) & 0xE0) == 0xC0)
|
||||
@@ -219,7 +219,7 @@ utf8_strlen (char *string)
|
||||
return strlen (string);
|
||||
|
||||
length = 0;
|
||||
while (string[0])
|
||||
while (string && string[0])
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
length++;
|
||||
@@ -250,7 +250,7 @@ utf8_strnlen (char *string, int bytes)
|
||||
|
||||
start = string;
|
||||
length = 0;
|
||||
while (string[0] && (string - start < bytes))
|
||||
while (string && string[0] && (string - start < bytes))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
length++;
|
||||
@@ -306,7 +306,7 @@ utf8_add_offset (char *string, int offset)
|
||||
return string + offset;
|
||||
|
||||
count = 0;
|
||||
while (string[0] && (count < offset))
|
||||
while (string && string[0] && (count < offset))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
count++;
|
||||
@@ -330,7 +330,7 @@ utf8_real_pos (char *string, int pos)
|
||||
|
||||
count = 0;
|
||||
real_pos = 0;
|
||||
while (string[0] && (count < pos))
|
||||
while (string && string[0] && (count < pos))
|
||||
{
|
||||
next_char = utf8_next_char (string);
|
||||
real_pos += (next_char - string);
|
||||
@@ -356,7 +356,7 @@ utf8_pos (char *string, int real_pos)
|
||||
|
||||
count = 0;
|
||||
limit = string + real_pos;
|
||||
while (string[0] && (string < limit))
|
||||
while (string && string[0] && (string < limit))
|
||||
{
|
||||
string = utf8_next_char (string);
|
||||
count++;
|
||||
|
||||
@@ -480,7 +480,7 @@ gui_color_init_pairs ()
|
||||
|
||||
if (has_colors ())
|
||||
{
|
||||
for (i = 1; i < COLOR_PAIRS; i++)
|
||||
for (i = 1; i < 64; i++)
|
||||
init_pair (i, shift_colors[i % 8], (i < 8) ? -1 : shift_colors[i / 8]);
|
||||
|
||||
/* disable white on white, replaced by black on white */
|
||||
|
||||
Reference in New Issue
Block a user