From: Richard Russon Date: Thu, 19 Sep 2019 23:25:28 +0000 (+0100) Subject: check retval of mutt_str_atoui() X-Git-Tag: 2019-10-25~36^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=23d0b803adcbc7081ce5fdb2c6110ad918c25405;p=neomutt check retval of mutt_str_atoui() --- 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))