X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_error.c;h=63dc0d35260783bec5292d4e41901f8f97db0d90;hb=674dee5af23a9cf9488f11880368c64a5ad70026;hp=dd056974b37526d1b67f6076f4ba576a5b776cd2;hpb=5a7eb5b62b485b61ddb80a40ef22f4337cf2289f;p=rrdtool.git diff --git a/src/rrd_error.c b/src/rrd_error.c index dd05697..63dc0d3 100644 --- a/src/rrd_error.c +++ b/src/rrd_error.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.2.5 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.18 Copyright by Tobi Oetiker, 1997-2006 ***************************************************************************** * rrd_error.c Common Header File ***************************************************************************** @@ -80,6 +80,7 @@ rrd_set_error_r(struct rrd_context *rrd_ctx, char *fmt, ...) va_start(argp, fmt); #ifdef HAVE_VSNPRINTF vsnprintf((char *)rrd_ctx->rrd_error, rrd_ctx->len, fmt, argp); + rrd_ctx->rrd_error[rrd_ctx->len]='\0'; #else vsprintf((char *)rrd_ctx->rrd_error, fmt, argp); #endif @@ -110,9 +111,8 @@ rrd_new_context(void) { (struct rrd_context *) malloc(sizeof(struct rrd_context)); if (rrd_ctx) { - rrd_ctx->len = 0; - rrd_ctx->rrd_error = malloc(MAXLEN); - rrd_ctx->lib_errstr = malloc(ERRBUFLEN); + rrd_ctx->rrd_error = malloc(MAXLEN+10); + rrd_ctx->lib_errstr = malloc(ERRBUFLEN+10); if (rrd_ctx->rrd_error && rrd_ctx->lib_errstr) { *rrd_ctx->rrd_error = 0; *rrd_ctx->lib_errstr = 0;