prevented buffer overflow when there are too many dimensions on a chart
Costa Tsaousis (ktsaou) committed
Sep 30, 2015 at 00:53 UTC
88e7231b0f930b816ade6a15dd6319b0af65ea3b
1 file changed
+5
-3
src/rrd2json.c
+5
-3
@@ -12,7 +12,7 @@ char *hostname = "unknown";
12
unsigned long rrd_stats_one_json(RRDSET *st, char *options, struct web_buffer *wb)
13
{
14
time_t now = time(NULL);
15
- web_buffer_increase(wb, 16384);
15
+ web_buffer_increase(wb, 65536);
16
17
pthread_rwlock_rdlock(&st->rwlock);
18
@@ -67,6 +67,8 @@ unsigned long rrd_stats_one_json(RRDSET *st, char *options, struct web_buffer *w
67
68
RRDDIM *rd;
69
for(rd = st->dimensions; rd ; rd = rd->next) {
70
+ web_buffer_increase(wb, 4096);
71
+
72
memory += rd->memsize;
73
74
web_buffer_printf(wb,
@@ -118,7 +120,7 @@ unsigned long rrd_stats_one_json(RRDSET *st, char *options, struct web_buffer *w
120
121
void rrd_stats_graph_json(RRDSET *st, char *options, struct web_buffer *wb)
122
{
121
- web_buffer_increase(wb, 16384);
123
+ web_buffer_increase(wb, 2048);
124
125
web_buffer_printf(wb, RRD_GRAPH_JSON_HEADER);
126
rrd_stats_one_json(st, options, wb);
@@ -127,7 +129,7 @@ void rrd_stats_graph_json(RRDSET *st, char *options, struct web_buffer *wb)
129
130
void rrd_stats_all_json(struct web_buffer *wb)
131
{
130
- web_buffer_increase(wb, 1024);
132
+ web_buffer_increase(wb, 2048);
133
134
unsigned long memory = 0;
135
long c;