Fix crash when receiving malformed labels via streaming. (#9715)
* Fix crash when receiving malformed labels via streaming. * Disallow empty _virtualization values in system_info.
Markos Fountoulakis committed
Aug 11, 2020 at 16:27 UTC
b0bfec14e2e1583077beead3827d29444cf05fd0
2 files changed
+9
collectors/plugins.d/pluginsd_parser.c
+5
@@ -517,6 +517,11 @@ PARSER_RC pluginsd_disable(char **words, void *user, PLUGINSD_ACTION *plugins_a
517
PARSER_RC pluginsd_label(char **words, void *user, PLUGINSD_ACTION *plugins_action)
518
{
519
char *store;
520
+
521
+ if (!words[1] || !words[2] || !words[3]) {
522
+ error("Ignoring malformed or empty LABEL command.");
523
+ return PARSER_RC_OK;
524
+ }
525
if (!words[4])
526
store = words[3];
527
else {
daemon/system-info.sh
+4
@@ -30,6 +30,10 @@ if [ -z "${VIRTUALIZATION}" ]; then
30
VIRTUALIZATION="none"
31
fi
32
fi
33
+ if [ -z "${VIRTUALIZATION}" ]; then
34
+ # Output from the command is outside of spec
35
+ VIRTUALIZATION="unknown"
36
+ fi
37
else
38
# Passed from outside - probably in docker run
39
VIRT_DETECTION="provided"