From 5b181f782a1558380afe24331d2f1b3b82b6f8d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sat, 3 Dec 2016 13:31:59 +0100 Subject: vis: improve :set option number parsing Only accept numbers in range [0, INT_MAX]. Reject trailing garbage, where before something like `:set cc 50NaN` worked it will now cause an error. Close #418 --- sam.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'sam.c') diff --git a/sam.c b/sam.c index 2c4fcb6..337f8a4 100644 --- a/sam.c +++ b/sam.c @@ -269,7 +269,6 @@ typedef struct { OPTION_TYPE_STRING, OPTION_TYPE_BOOL, OPTION_TYPE_NUMBER, - OPTION_TYPE_UNSIGNED, } type; enum { OPTION_FLAG_NONE = 0, @@ -370,7 +369,7 @@ static const OptionDef options[] = { }, [OPTION_HORIZON] = { { "horizon" }, - OPTION_TYPE_UNSIGNED, OPTION_FLAG_WINDOW, + OPTION_TYPE_NUMBER, OPTION_FLAG_WINDOW, "Number of bytes to consider for syntax highlighting", }, }; -- cgit v1.2.3