X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=program%2Fsrc%2Frrd_error.c;h=89e4c32df2d2a9a54f4050f885ac04854fb68ba8;hb=093a3aef272b7197ae4539de48dd2ed4c67a46e4;hp=1ca06012805575b7eda1954a371f716a0611a451;hpb=21b378b03f851fb8e0445e02c009f481607d75c2;p=rrdtool-all.git diff --git a/program/src/rrd_error.c b/program/src/rrd_error.c index 1ca06012..89e4c32d 100644 --- a/program/src/rrd_error.c +++ b/program/src/rrd_error.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.2.1 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.30 Copyright by Tobi Oetiker, 1997-2009 ***************************************************************************** * 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;