summaryrefslogtreecommitdiffstats
path: root/web
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2020-08-04 19:31:44 +0300
committerGitHub <noreply@github.com>2020-08-04 18:31:44 +0200
commit01c220b90e45ff05b418984647bf4a69aa147155 (patch)
tree6dfe9ace589c35d59214a1d409826df91308ed1c /web
parent211137df801d1b3e4d4d484a10c4ec42d8640040 (diff)
installer: update `go.d.plugin` version to v0.20.0 (#9644)
Bumps the go.d plugin version to 0.20.0, includes the Prometheus Generic Collector. Fixes a bug in dimension name / id escaping that could break the json output of the web API. Co-authored-by: Andrew Moss <1043609+amoss@users.noreply.github.com>
Diffstat (limited to 'web')
-rw-r--r--web/api/formatters/rrdset2json.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/web/api/formatters/rrdset2json.c b/web/api/formatters/rrdset2json.c
index 21feceb451..373c23010f 100644
--- a/web/api/formatters/rrdset2json.c
+++ b/web/api/formatters/rrdset2json.c
@@ -72,14 +72,14 @@ void rrdset2json(RRDSET *st, BUFFER *wb, size_t *dimensions_count, size_t *memor
memory += rd->memsize;
- buffer_sprintf(
- wb
- , "%s"
- "\t\t\t\t\"%s\": { \"name\": \"%s\" }"
- , dimensions ? ",\n" : ""
- , rd->id
- , rd->name
- );
+ if (dimensions)
+ buffer_strcat(wb, ",\n\t\t\t\t\"");
+ else
+ buffer_strcat(wb, "\t\t\t\t\"");
+ buffer_strcat_jsonescape(wb, rd->id);
+ buffer_strcat(wb, "\": { \"name\": \"");
+ buffer_strcat_jsonescape(wb, rd->name);
+ buffer_strcat(wb, "\" }");
dimensions++;
}