X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=src%2Frrd_error.c;h=77318e3c6aaaf0fbc0a4d5f3f626f136cb19b74c;hp=850e7ebfdac807e15475aba56c6e7b067c4c3de7;hb=7f4dd5f9c0f20e4d6690685641a9cd8ea621da51;hpb=990fcfb7eec407edfe504f42760bae204e1c074d diff --git a/src/rrd_error.c b/src/rrd_error.c index 850e7eb..77318e3 100644 --- a/src/rrd_error.c +++ b/src/rrd_error.c @@ -1,5 +1,5 @@ /***************************************************************************** - * RRDtool 1.2rc9 Copyright by Tobi Oetiker, 1997-2005 + * RRDtool 1.2.20 Copyright by Tobi Oetiker, 1997-2007 ***************************************************************************** * 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;