From c17c6d6ea550b2c0fe1e58d5ea69d39c0b8e4a8c Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Fri, 14 Jun 2019 12:38:42 +0200 Subject: command.c: Improve return check condition in cmd_execut_command_real() Check against MAX argc is changed to == since it cannot be incremented twice without passing the check. Change-Id: Ia330e475989fda863bedcc3cbf94deaf8dd83037 --- src/vty/command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/vty/command.c') diff --git a/src/vty/command.c b/src/vty/command.c index 4189c7c0..b26e9919 100644 --- a/src/vty/command.c +++ b/src/vty/command.c @@ -2313,7 +2313,7 @@ cmd_execute_command_real(vector vline, struct vty *vty, argv[argc++] = vector_slot(vline, i); } - if (argc >= CMD_ARGC_MAX) + if (argc == CMD_ARGC_MAX) return CMD_ERR_EXEED_ARGC_MAX; } @@ -2458,7 +2458,7 @@ cmd_execute_command_strict(vector vline, struct vty *vty, argv[argc++] = vector_slot(vline, i); } - if (argc >= CMD_ARGC_MAX) + if (argc == CMD_ARGC_MAX) return CMD_ERR_EXEED_ARGC_MAX; } -- cgit v1.2.3