X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Frrd_error.c;h=68fcc8e67306625dfd805946bfadadf6273fe285;hb=12408853ccdabd7d2aff1b86dc848a2755391bd2;hp=a102b1fe48063114d15f8b0ddf68f1de529d909f;hpb=7f408c1ae7d1011c489fbd9123b1dd03d869e088;p=rrdtool.git diff --git a/src/rrd_error.c b/src/rrd_error.c index a102b1f..68fcc8e 100644 --- a/src/rrd_error.c +++ b/src/rrd_error.c @@ -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,7 +111,6 @@ 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+10); rrd_ctx->lib_errstr = malloc(ERRBUFLEN+10); if (rrd_ctx->rrd_error && rrd_ctx->lib_errstr) {