From: Costa Tsaousis (ktsaou) Date: Tue, 29 Sep 2015 21:53:32 +0000 (+0300) Subject: prevented buffer overflow when there are too many dimensions on a chart X-Git-Tag: v1.0rc~326 X-Git-Url: https://arthur.barton.de/gitweb/?a=commitdiff_plain;h=88e7231b0f930b816ade6a15dd6319b0af65ea3b;p=netdata.git prevented buffer overflow when there are too many dimensions on a chart --- diff --git a/src/rrd2json.c b/src/rrd2json.c index 575066e4..875ea6d9 100755 --- a/src/rrd2json.c +++ b/src/rrd2json.c @@ -12,7 +12,7 @@ char *hostname = "unknown"; unsigned long rrd_stats_one_json(RRDSET *st, char *options, struct web_buffer *wb) { time_t now = time(NULL); - web_buffer_increase(wb, 16384); + web_buffer_increase(wb, 65536); pthread_rwlock_rdlock(&st->rwlock); @@ -67,6 +67,8 @@ unsigned long rrd_stats_one_json(RRDSET *st, char *options, struct web_buffer *w RRDDIM *rd; for(rd = st->dimensions; rd ; rd = rd->next) { + web_buffer_increase(wb, 4096); + memory += rd->memsize; web_buffer_printf(wb, @@ -118,7 +120,7 @@ unsigned long rrd_stats_one_json(RRDSET *st, char *options, struct web_buffer *w void rrd_stats_graph_json(RRDSET *st, char *options, struct web_buffer *wb) { - web_buffer_increase(wb, 16384); + web_buffer_increase(wb, 2048); web_buffer_printf(wb, RRD_GRAPH_JSON_HEADER); rrd_stats_one_json(st, options, wb); @@ -127,7 +129,7 @@ void rrd_stats_graph_json(RRDSET *st, char *options, struct web_buffer *wb) void rrd_stats_all_json(struct web_buffer *wb) { - web_buffer_increase(wb, 1024); + web_buffer_increase(wb, 2048); unsigned long memory = 0; long c;