]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: fix check for unknown in cmd_op_to_name
author谢致邦 (XIE Zhibang) <Yeking@Red54.com>
Wed, 7 Feb 2024 15:10:20 +0000 (15:10 +0000)
committerPhil Sutter <phil@nwl.cc>
Wed, 7 Feb 2024 17:05:53 +0000 (18:05 +0100)
Example:
nft --debug=all destroy table ip missingtable

Before:
Evaluate unknown

After:
Evaluate destroy

Fixes: e1dfd5cc4c46 ("src: add support to command "destroy"")
Signed-off-by: 谢致邦 (XIE Zhibang) <Yeking@Red54.com>
Signed-off-by: Phil Sutter <phil@nwl.cc>
src/evaluate.c

index 89411fa8c7b4b33d369277a0ddef2fcdf57acfbf..1b430b72de203c0855ae6ebd6326c2cd3b67b60e 100644 (file)
@@ -6045,7 +6045,7 @@ static const char * const cmd_op_name[] = {
 
 static const char *cmd_op_to_name(enum cmd_ops op)
 {
-       if (op > CMD_DESCRIBE)
+       if (op >= array_size(cmd_op_name))
                return "unknown";
 
        return cmd_op_name[op];