diff options
author | Stelios Fragkakis <52996999+stelfrag@users.noreply.github.com> | 2024-05-17 13:53:54 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-17 13:53:54 +0300 |
commit | a33b13f66791f0777053ba6aa6336823217ee8c6 (patch) | |
tree | fea08a2830fe648388676c37b26a7c5aa04a8413 | |
parent | 9fd7845e9a69c72078b7f7a41dfa49be29aee0f9 (diff) |
Check for empty dimension id from a plugin (#17690)
Check for empty dimension or dimension creation failure and disable plugin
-rw-r--r-- | src/collectors/plugins.d/pluginsd_parser.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/collectors/plugins.d/pluginsd_parser.c b/src/collectors/plugins.d/pluginsd_parser.c index 3b6f8f8c52..cfc8b3d94a 100644 --- a/src/collectors/plugins.d/pluginsd_parser.c +++ b/src/collectors/plugins.d/pluginsd_parser.c @@ -433,7 +433,7 @@ static inline PARSER_RC pluginsd_dimension(char **words, size_t num_words, PARSE RRDSET *st = pluginsd_require_scope_chart(parser, PLUGINSD_KEYWORD_DIMENSION, PLUGINSD_KEYWORD_CHART); if(!st) return PLUGINSD_DISABLE_PLUGIN(parser, NULL, NULL); - if (unlikely(!id)) + if (unlikely(!id || !*id)) return PLUGINSD_DISABLE_PLUGIN(parser, PLUGINSD_KEYWORD_DIMENSION, "missing dimension id"); long multiplier = 1; @@ -461,6 +461,9 @@ static inline PARSER_RC pluginsd_dimension(char **words, size_t num_words, PARSE options ? options : ""); RRDDIM *rd = rrddim_add(st, id, name, multiplier, divisor, rrd_algorithm_id(algorithm)); + if (unlikely(!rd)) + return PLUGINSD_DISABLE_PLUGIN(parser, PLUGINSD_KEYWORD_DIMENSION, "failed to create dimension"); + int unhide_dimension = 1; rrddim_option_clear(rd, RRDDIM_OPTION_DONT_DETECT_RESETS_OR_OVERFLOWS); |