summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@finalrewind.org>2014-05-11 13:48:48 +0200
committerDaniel Friesel <derf@finalrewind.org>2014-05-11 13:48:48 +0200
commitd3275f49374d258c6962d101321b218fc70fec89 (patch)
treeeef7acaf5fa02c78618bde26fbf4a5466e1cc52b /src
parent2cbfb7eea3ab6bdcc056f5ce42967e79ddcda4a2 (diff)
feh_printf: Fix buffer overflow when handling unknown format specifiers
Diffstat (limited to 'src')
-rw-r--r--src/slideshow.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/slideshow.c b/src/slideshow.c
index 8aa783c..a18c1f8 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -584,7 +584,8 @@ char *feh_printf(char *str, feh_file * file, winwidget winwid)
break;
default:
weprintf("Unrecognized format specifier %%%c", *c);
- strncat(ret, c - 1, 2);
+ if ((strlen(ret) + 3) < sizeof(ret))
+ strncat(ret, c - 1, 2);
break;
}
} else if ((*c == '\\') && (*(c+1) != '\0') && ((strlen(ret) + 3) < sizeof(ret))) {