From 922630f76f395f44bcf24637f7c8d06cf051fccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 1 Jun 2020 20:35:22 +0300 Subject: [PATCH] MXS-3019: Fix enum value validation Also added a test case that reproduces the problem and verifies that it is fixed. --- server/core/config.cc | 4 ++++ server/core/test/test_config.cc | 1 + 2 files changed, 5 insertions(+) diff --git a/server/core/config.cc b/server/core/config.cc index b0356373b..e24f97f91 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -4535,6 +4535,10 @@ bool config_param_is_valid(const MXS_MODULE_PARAM* params, /** Either the only defined enum value is not valid * or multiple values were defined */ valid = false; + } + + if (!valid) + { break; } } diff --git a/server/core/test/test_config.cc b/server/core/test/test_config.cc index 6fcd33584..c21df1148 100644 --- a/server/core/test/test_config.cc +++ b/server/core/test/test_config.cc @@ -91,6 +91,7 @@ int test_validity() TEST(config_param_is_valid(params, "p5", "c,a,b", &ctx)); TEST(!config_param_is_valid(params, "p5", "d", &ctx)); TEST(!config_param_is_valid(params, "p5", "a,d", &ctx)); + TEST(!config_param_is_valid(params, "p5", "d,a", &ctx)); TEST(!config_param_is_valid(params, "p5", "a,b,c,d", &ctx)); /** Path parameter */