diff options
author | Nei <ailin.nemui@gmail.com> | 2017-01-02 17:01:47 +0000 |
---|---|---|
committer | Nei <ailin.nemui@gmail.com> | 2017-01-02 17:01:47 +0000 |
commit | 1b99299ed2af2ae459edbeb96f2a7b7886cc22c9 (patch) | |
tree | a974914177ca947a39cb2793f3020f0c869c596c /src | |
parent | 124bcd48048762de9d17ff4f46df1cbfda9c1fb5 (diff) | |
parent | 7dc2f832c19d8b5c682f5c9abd106ab6be53bf62 (diff) | |
download | irssi-1b99299ed2af2ae459edbeb96f2a7b7886cc22c9.zip |
Merge branch 'percent_flag' into 'security'
fix %[
See merge request !5
Diffstat (limited to 'src')
-rw-r--r-- | src/fe-common/core/formats.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/fe-common/core/formats.c b/src/fe-common/core/formats.c index a789c0e3..17c13a97 100644 --- a/src/fe-common/core/formats.c +++ b/src/fe-common/core/formats.c @@ -68,7 +68,7 @@ static void format_expand_code(const char **format, GString *out, int *flags) if (flags == NULL) { /* flags are being ignored - skip the code */ - while (**format != ']') + while (**format != ']' && **format != '\0') (*format)++; return; } @@ -246,6 +246,10 @@ int format_expand_styles(GString *out, const char **format, int *flags) case '[': /* code */ format_expand_code(format, out, flags); + if ((*format)[0] == '\0') + /* oops, reached end prematurely */ + (*format)--; + break; case 'x': case 'X': |