diff options
author | Markos Fountoulakis <44345837+mfundul@users.noreply.github.com> | 2020-08-11 16:27:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-11 16:27:11 +0300 |
commit | b0bfec14e2e1583077beead3827d29444cf05fd0 (patch) | |
tree | 95769dd7a4c80ce6eb8fc5733ff4587eb0451056 | |
parent | 56bc902bc6e08d191be8ec8a2c7833f322773610 (diff) |
Fix crash when receiving malformed labels via streaming. (#9715)
* Fix crash when receiving malformed labels via streaming.
* Disallow empty _virtualization values in system_info.
-rw-r--r-- | collectors/plugins.d/pluginsd_parser.c | 5 | ||||
-rwxr-xr-x | daemon/system-info.sh | 4 |
2 files changed, 9 insertions, 0 deletions
diff --git a/collectors/plugins.d/pluginsd_parser.c b/collectors/plugins.d/pluginsd_parser.c index 2b759869c1..a02dcf006e 100644 --- a/collectors/plugins.d/pluginsd_parser.c +++ b/collectors/plugins.d/pluginsd_parser.c @@ -517,6 +517,11 @@ PARSER_RC pluginsd_disable(char **words, void *user, PLUGINSD_ACTION *plugins_a PARSER_RC pluginsd_label(char **words, void *user, PLUGINSD_ACTION *plugins_action) { char *store; + + if (!words[1] || !words[2] || !words[3]) { + error("Ignoring malformed or empty LABEL command."); + return PARSER_RC_OK; + } if (!words[4]) store = words[3]; else { diff --git a/daemon/system-info.sh b/daemon/system-info.sh index 0cd24fc4f5..dcdc099688 100755 --- a/daemon/system-info.sh +++ b/daemon/system-info.sh @@ -30,6 +30,10 @@ if [ -z "${VIRTUALIZATION}" ]; then VIRTUALIZATION="none" fi fi + if [ -z "${VIRTUALIZATION}" ]; then + # Output from the command is outside of spec + VIRTUALIZATION="unknown" + fi else # Passed from outside - probably in docker run VIRT_DETECTION="provided" |