1
0
mirror of https://github.com/irssi/irssi.git synced 2024-09-29 04:45:57 -04:00

Merge branch 'percent_flag' into 'security'

fix %[

See merge request !5
This commit is contained in:
Nei 2017-01-02 17:01:47 +00:00
commit 1b99299ed2

View File

@ -68,7 +68,7 @@ static void format_expand_code(const char **format, GString *out, int *flags)
if (flags == NULL) { if (flags == NULL) {
/* flags are being ignored - skip the code */ /* flags are being ignored - skip the code */
while (**format != ']') while (**format != ']' && **format != '\0')
(*format)++; (*format)++;
return; return;
} }
@ -246,6 +246,10 @@ int format_expand_styles(GString *out, const char **format, int *flags)
case '[': case '[':
/* code */ /* code */
format_expand_code(format, out, flags); format_expand_code(format, out, flags);
if ((*format)[0] == '\0')
/* oops, reached end prematurely */
(*format)--;
break; break;
case 'x': case 'x':
case 'X': case 'X':