From e289d34b9a50b46f57698980e899b71f0069abda Mon Sep 17 00:00:00 2001 From: ailin-nemui Date: Wed, 14 Feb 2018 15:04:16 +0100 Subject: limit alignment padding to a screenful Credit to Oss-Fuzz --- src/core/special-vars.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') 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_; -- cgit v1.2.3