- only copy as many bytes as necessary
 - during journal replay, avoid unnecessary copy (string is discarded)

Thank you Thorsten von Eicken <t...@rightscale.com>
---
 src/rrd_daemon.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/rrd_daemon.c b/src/rrd_daemon.c
index 0ca1818..1946003 100644
--- a/src/rrd_daemon.c
+++ b/src/rrd_daemon.c
@@ -1312,7 +1312,8 @@ static int handle_request_update (HANDLER_PROTO) /* {{{ */
   cache_item_t *ci;
 
   /* save it for the journal later */
-  strncpy(orig_buf, buffer, sizeof(orig_buf)-1);
+  if (sock != NULL)
+    strncpy(orig_buf, buffer, buffer_size);
 
   status = buffer_get_field (&buffer, &buffer_size, &file);
   if (status != 0)
-- 
1.6.4

_______________________________________________
rrd-developers mailing list
rrd-developers@lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers

Reply via email to