From e8760ad579cae936b32308088e3ed78d9aeb273e Mon Sep 17 00:00:00 2001 From: Sergey Kitov Date: Wed, 31 May 2017 14:32:30 +0300 Subject: [PATCH] quota: assertion for *args != NULL is added in order to avoid warning from static analyzer and *args[0] changed to (*args)[0] --- src/plugins/quota/quota.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/quota/quota.c b/src/plugins/quota/quota.c index 014578ad62..fdc2869e26 100644 --- a/src/plugins/quota/quota.c +++ b/src/plugins/quota/quota.c @@ -1395,6 +1395,7 @@ int quota_parse_parameters(struct quota_root *root, const char **args, const cha for (; valid_params->param_name != NULL; ++valid_params) { tmp_param_name = valid_params->param_name; tmp_param_len = strlen(valid_params->param_name); + i_assert(*args != NULL); if (strncmp(*args, tmp_param_name, tmp_param_len) == 0) { tmp_param_val = NULL; *args += tmp_param_len; @@ -1405,9 +1406,9 @@ int quota_parse_parameters(struct quota_root *root, const char **args, const cha t_strdup_until(*args, next_colon); *args = (next_colon == NULL) ? NULL : next_colon + 1; } - else if (*args[0] == '\0' || - *args[0] == ':') { - *args = (*args[0] == ':') ? *args + 1 : NULL; + else if ((*args)[0] == '\0' || + (*args)[0] == ':') { + *args = ((*args)[0] == ':') ? *args + 1 : NULL; /* in case parameter is a boolean second parameter * string parameter value will be ignored by param_handler * we just need some non-NULL value -- 2.47.3