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.verplant.org/?a=commitdiff_plain;h=2a9fa65d670ac4a88c78e553351e92678d85fd93;p=rrdtool.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/program@1021 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_tool.c b/src/rrd_tool.c index bb82c38..c987c91 100644 --- a/src/rrd_tool.c +++ b/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)){