main: Validate the number of numeric options
PATCH v2 1/2 main: Validate the number of numeric options
The number of numeric options influences the behavior and the user should be warned if a invalid number is used.
Signed-off-by Elise Lennion <[email protected]>
---
v2: Was split from a bigger patch. Now an error is triggered when a invalid number of numeric options is used, instead of allowing it and using the closer valid number.
src/main.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
src/main.c +6 -1
@@ -288,7 +288,12 @@ int main(int argc, char * const *argv) include_paths[num_include_paths++] = optarg;break ;case OPT_NUMERIC : - numeric_output++; +if (++numeric_output >NUMERIC_ALL ) { +fprintf (stderr,"Too many numeric options " +"used, max. %u\n" , +NUMERIC_ALL ); +exit (NFT_EXIT_FAILURE ); + }break ;case OPT_STATELESS : stateless_output++;
Signature · 1 line
2.7.4
Quoted 2 lines · Elise Lennion
The number of numeric options influences the behavior and the user should be warned if a invalid number is used.
Applied, thanks Elise.