diff options
author | Nei <ailin.nemui@gmail.com> | 2017-10-20 13:10:39 +0000 |
---|---|---|
committer | ailin-nemui <ailin-nemui@users.noreply.github.com> | 2017-10-20 15:22:32 +0200 |
commit | e37d9b24979e20d03478a9d355eb7fc7ff8d246f (patch) | |
tree | c3057ff5afc2b6836cdda0c7b087bb310c9fc1ab | |
parent | 28d0b8c74602db0474c78ccbe17ae1ba03fcf665 (diff) | |
parent | 00c80cb6fcca40cfc421fe3fc181115ac4907191 (diff) | |
download | irssi-e37d9b24979e20d03478a9d355eb7fc7ff8d246f.zip |
Merge branch 'fix-gl-12' into 'security'
fix out of bounds read in compress_colors
See merge request irssi/irssi!18
-rw-r--r-- | src/fe-common/core/themes.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fe-common/core/themes.c b/src/fe-common/core/themes.c index 2b1459be..cb1cce8f 100644 --- a/src/fe-common/core/themes.c +++ b/src/fe-common/core/themes.c @@ -587,7 +587,7 @@ static char *theme_format_compress_colors(THEME_REC *theme, const char *format) /* a normal character */ g_string_append_c(str, *format); format++; - } else { + } else if (format[1] != '\0') { /* %format */ format++; if (IS_OLD_FORMAT(*format, last_fg, last_bg)) { @@ -614,6 +614,11 @@ static char *theme_format_compress_colors(THEME_REC *theme, const char *format) last_bg = '\0'; } format++; + } else { + /* % at end of string */ + format++; + g_string_append_c(str, '%'); + g_string_append_c(str, '%'); } } |