summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2018-02-14 15:04:16 +0100
committerailin-nemui <ailin-nemui@users.noreply.github.com>2018-02-14 15:04:24 +0100
commite289d34b9a50b46f57698980e899b71f0069abda (patch)
tree87af357c9c7abdd7c4c8dbac1dbb5f4813b214a1
parenta2bc308dca885c294d6f63e12b6353115a0f38fe (diff)
downloadirssi-e289d34b9a50b46f57698980e899b71f0069abda.zip
limit alignment padding to a screenful
Credit to Oss-Fuzz
-rw-r--r--src/core/special-vars.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/core/special-vars.c b/src/core/special-vars.c
index e131b0ed..33d9cd55 100644
--- a/src/core/special-vars.c
+++ b/src/core/special-vars.c
@@ -33,6 +33,8 @@
#define isarg(c) \
(i_isdigit(c) || (c) == '*' || (c) == '~' || (c) == '-')
+#define ALIGN_MAX 222488
+
static SPECIAL_HISTORY_FUNC history_func = NULL;
static char *get_argument(char **cmd, char **arglist)
@@ -300,6 +302,10 @@ static int get_alignment_args(char **data, int *align, int *flags, char *pad)
if (!parse_uint(str, &endptr, 10, &align_)) {
return FALSE;
}
+ /* alignment larger than supported */
+ if (align_ > ALIGN_MAX) {
+ return FALSE;
+ }
str = endptr;
*align = align_;