From 23d0b803adcbc7081ce5fdb2c6110ad918c25405 Mon Sep 17 00:00:00 2001 From: Richard Russon Date: Fri, 20 Sep 2019 00:25:28 +0100 Subject: [PATCH] check retval of mutt_str_atoui() --- color.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/color.c b/color.c index b54178c96..d9a23289b 100644 --- a/color.c +++ b/color.c @@ -1133,10 +1133,15 @@ static enum CommandResult parse_color(struct Buffer *buf, struct Buffer *s, if (MoreArgs(s)) { - struct Buffer temporary = mutt_buffer_make(0); - mutt_extract_token(&temporary, s, MUTT_TOKEN_NO_FLAGS); - mutt_str_atoui(temporary.data, &match); - FREE(&temporary.data); + struct Buffer tmp = mutt_buffer_make(0); + mutt_extract_token(&tmp, s, MUTT_TOKEN_NO_FLAGS); + if (mutt_str_atoui(tmp.data, &match) < 0) + { + mutt_buffer_printf(err, _("%s: invalid number: %s"), color ? "color" : "mono", tmp.data); + mutt_buffer_dealloc(&tmp); + return MUTT_CMD_WARNING; + } + mutt_buffer_dealloc(&tmp); } if (MoreArgs(s)) -- 2.40.0