From 32a2abd50d1d15a4278236a13d451a208f51813a Mon Sep 17 00:00:00 2001 From: Michal Bloch Date: Tue, 6 Apr 2021 14:36:59 +0200 Subject: [PATCH] Increase config entry field lengths 32 is not enough for limiter rules for long tags. Examples: CAPI_APPFW_APPLICATION, SAMSUNG_CONNECT_SERVICE. Change-Id: I296ece081595316f83894e48f28cfe9679f6cecc Signed-off-by: Michal Bloch --- include/logconfig.h | 4 ++-- src/tests/config.c | 7 ++----- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/logconfig.h b/include/logconfig.h index 7e746d6..afc7d9e 100644 --- a/include/logconfig.h +++ b/include/logconfig.h @@ -27,8 +27,8 @@ #include #include -#define MAX_CONF_KEY_LEN 32 -#define MAX_CONF_VAL_LEN 256 +#define MAX_CONF_KEY_LEN 160 // TAGs have a soft length limit of 128, so limiter rules need a bit more +#define MAX_CONF_VAL_LEN 344 // arbitrary, happens to align the conf entry struct to 512 #define MAX_CONF_ENTRY_LEN (MAX_CONF_KEY_LEN + MAX_CONF_VAL_LEN + 2) // +2 for the delimiter and newline #define DEFAULT_CONFIG_SUFFIX ".conf" diff --git a/src/tests/config.c b/src/tests/config.c index 196bae4..a9d3196 100644 --- a/src/tests/config.c +++ b/src/tests/config.c @@ -122,11 +122,8 @@ int main() assert(log_config_get_int(&config, "invalid_extra_conf", 678) == 678); /* test key length limits */ - get = log_config_get(&config, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); - assert(get); - assert(!strcmp(get, "foo")); - - get = log_config_get(&config, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); + char long_key[1000] = { [0 ... 998] = 'a', [999] = '\0' }; + get = log_config_get(&config, long_key); assert(!get); /* test existing key modification */ -- 2.7.4