From: oetiker Date: Thu, 15 Mar 2007 21:10:18 +0000 (+0000) Subject: fix the snprintf call for vtag ... it was using the wrong size -- kili X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=13ba5d72a482a2b9d293e00e137e65c8a1e599a6;p=rrdtool-all.git fix the snprintf call for vtag ... it was using the wrong size -- kili git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@1021 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_tool.c b/program/src/rrd_tool.c index bb82c38f..c987c91b 100644 --- a/program/src/rrd_tool.c +++ b/program/src/rrd_tool.c @@ -689,8 +689,8 @@ int HandleInputLine(int argc, char **argv, FILE* out) char **legend_v; int enumds = 0; int i; - char *vtag = NULL; - vtag = malloc( strlen(COL_DATA_TAG)+10); + size_t vtag_s = strlen(COL_DATA_TAG) + 10; + char *vtag = malloc(vtag_s); for ( i = 2; i < argc; i++){ if (strcmp("--enumds", argv[i]) == 0) enumds = 1; @@ -724,9 +724,9 @@ int HandleInputLine(int argc, char **argv, FILE* out) for (j = 0; j < col_cnt; j++) { rrd_value_t newval = DNAN; if (enumds == 1) - snprintf(vtag,sizeof(vtag),"%s%lu", COL_DATA_TAG, j); + snprintf(vtag,vtag_s,"%s%lu", COL_DATA_TAG, j); else - snprintf(vtag,sizeof(vtag),"%s",COL_DATA_TAG); + snprintf(vtag,vtag_s,"%s",COL_DATA_TAG); newval = *ptr; if(isnan(newval)){