diff options
author | Stefan Bühler <stbuehler@web.de> | 2014-02-14 21:06:03 +0000 |
---|---|---|
committer | Stefan Bühler <stbuehler@web.de> | 2014-02-14 21:06:03 +0000 |
commit | 0aaf939e5ec05db711f26acafc9909ee95cca172 (patch) | |
tree | 50edd96a4652bdeab6a44ebaa4d45193a5adba40 /src/mod_rrdtool.c | |
parent | fc3a060a047250c22ba1ba38c6113c3584264aa9 (diff) | |
download | lighttpd-git-0aaf939e5ec05db711f26acafc9909ee95cca172.tar.gz |
[mod_rrdtool] fix invalid read (string not null terminated)
From: Stefan Bühler <stbuehler@web.de>
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@2940 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/mod_rrdtool.c')
-rw-r--r-- | src/mod_rrdtool.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mod_rrdtool.c b/src/mod_rrdtool.c index 122c79ec..5c5ea881 100644 --- a/src/mod_rrdtool.c +++ b/src/mod_rrdtool.c @@ -437,7 +437,7 @@ TRIGGER_FUNC(mod_rrd_trigger) { } buffer_prepare_copy(p->resp, 4096); - if (-1 == (r = safe_read(p->read_fd, p->resp->ptr, p->resp->size))) { + if (-1 == (r = safe_read(p->read_fd, p->resp->ptr, p->resp->size - 1))) { p->rrdtool_running = 0; log_error_write(srv, __FILE__, __LINE__, "ss", @@ -446,7 +446,8 @@ TRIGGER_FUNC(mod_rrd_trigger) { return HANDLER_ERROR; } - p->resp->used = r; + p->resp->used = r + 1; + p->resp->ptr[r] = '\0'; if (p->resp->ptr[0] != 'O' || p->resp->ptr[1] != 'K') { |