summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: bb3b409)
raw | patch | inline | side by side (parent: bb3b409)
author | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 16 Dec 2006 16:14:43 +0000 (16:14 +0000) | ||
committer | oetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa> | |
Sat, 16 Dec 2006 16:14:43 +0000 (16:14 +0000) |
program/src/rrd_error.c | patch | blob | history | |
program/src/rrd_thread_safe.c | patch | blob | history | |
program/src/rrd_thread_safe_nt.c | patch | blob | history |
index a102b1fe48063114d15f8b0ddf68f1de529d909f..68fcc8e67306625dfd805946bfadadf6273fe285 100644 (file)
--- a/program/src/rrd_error.c
+++ b/program/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) {
index c06da050faaa13b977293eb10ba910a2153be21e..bccea99fba2f8508672bc5c8430152405e8c0024 100644 (file)
ctx = rrd_get_context();
pthread_mutex_lock(&mtx);
strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
+ ctx->lib_errstr[ctx->errlen]='\0';
pthread_mutex_unlock(&mtx);
return ctx->lib_errstr;
}
index 8f68ea395b853a047ba2b1fd2fd6133c6646abca..105507f2747160f052f1d7f357d6d487018c1ded 100644 (file)
EnterCriticalSection(&CriticalSection);
strncpy(ctx->lib_errstr, strerror(err), ctx->errlen);
- LeaveCriticalSection(&CriticalSection);
+ ctx->lib_errstr[ctx->errlen] = '\0';
+ LeaveCriticalSection(&CriticalSection);
return ctx->lib_errstr;
}