diff --git a/src/rrd_error.c b/src/rrd_error.c
index a102b1fe48063114d15f8b0ddf68f1de529d909f..68fcc8e67306625dfd805946bfadadf6273fe285 100644 (file)
--- a/src/rrd_error.c
+++ b/src/rrd_error.c
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
(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) {