1
0
mirror of https://github.com/weechat/weechat.git synced 2026-06-28 22:06:38 +02:00

Fixed crash when command line is ending by char '%'

This commit is contained in:
Sebastien Helleu
2005-11-11 23:01:21 +00:00
parent 92a2a0774c
commit 483d4670e1
2 changed files with 8 additions and 2 deletions
+4 -1
View File
@@ -349,7 +349,7 @@ gui_color_encode (unsigned char *string)
unsigned char *out;
int out_length, out_pos;
out_length = strlen ((char *)string) + 1;
out_length = (strlen ((char *)string) * 2) + 1;
out = (unsigned char *)malloc (out_length);
if (!out)
return NULL;
@@ -363,6 +363,9 @@ gui_color_encode (unsigned char *string)
string++;
switch (string[0])
{
case '\0':
out[out_pos++] = '%';
break;
case '%': /* double '%' replaced by single '%' */
out[out_pos++] = string[0];
string++;
+4 -1
View File
@@ -349,7 +349,7 @@ gui_color_encode (unsigned char *string)
unsigned char *out;
int out_length, out_pos;
out_length = strlen ((char *)string) + 1;
out_length = (strlen ((char *)string) * 2) + 1;
out = (unsigned char *)malloc (out_length);
if (!out)
return NULL;
@@ -363,6 +363,9 @@ gui_color_encode (unsigned char *string)
string++;
switch (string[0])
{
case '\0':
out[out_pos++] = '%';
break;
case '%': /* double '%' replaced by single '%' */
out[out_pos++] = string[0];
string++;