summaryrefslogtreecommitdiff
path: root/src/fe-common
diff options
context:
space:
mode:
authorNei <ailin.nemui@gmail.com>2017-10-20 13:10:39 +0000
committerailin-nemui <ailin-nemui@users.noreply.github.com>2017-10-20 15:22:32 +0200
commite37d9b24979e20d03478a9d355eb7fc7ff8d246f (patch)
treec3057ff5afc2b6836cdda0c7b087bb310c9fc1ab /src/fe-common
parent28d0b8c74602db0474c78ccbe17ae1ba03fcf665 (diff)
parent00c80cb6fcca40cfc421fe3fc181115ac4907191 (diff)
downloadirssi-e37d9b24979e20d03478a9d355eb7fc7ff8d246f.zip
Merge branch 'fix-gl-12' into 'security'
fix out of bounds read in compress_colors See merge request irssi/irssi!18
Diffstat (limited to 'src/fe-common')
-rw-r--r--src/fe-common/core/themes.c7
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, '%');
}
}