Decrement argc first before check the closing ']' to avoid the *argv[argc - 1]. No functional change. Signed-off-by: Marco Felsch <m.felsch@xxxxxxxxxxxxxx> --- commands/test.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/test.c b/commands/test.c index c845cec017..c1b84c42ef 100644 --- a/commands/test.c +++ b/commands/test.c @@ -75,11 +75,11 @@ static int do_test(int argc, char *argv[]) struct stat statbuf; if (*argv[0] == '[') { - if (*argv[argc - 1] != ']') { + argc--; + if (*argv[argc] != ']') { printf("[: missing `]'\n"); return 1; } - argc--; } /* args? */ -- 2.39.2