From 4eccc1acb6fde51cfc1bf3da16356dee1c019267 Mon Sep 17 00:00:00 2001 From: MassimilianoPinto Date: Thu, 11 Feb 2016 17:06:13 +0100 Subject: [PATCH] When creating heartbeat packet too many bytes were copied. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The memory area ‘ptr’ points to contains now the right data --- server/modules/routing/binlog/blr_slave.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/modules/routing/binlog/blr_slave.c b/server/modules/routing/binlog/blr_slave.c index b5ecdc436..79ad6a3f5 100644 --- a/server/modules/routing/binlog/blr_slave.c +++ b/server/modules/routing/binlog/blr_slave.c @@ -4609,13 +4609,14 @@ GWBUF *resp; uint8_t *ptr; int len = BINLOG_EVENT_HDR_LEN; uint32_t chksum; +int filename_len = strlen(slave->binlogfile); /* Add CRC32 4 bytes */ if (!slave->nocrc) len +=4; /* add binlogname to data content len */ - len += strlen(slave->binlogfile); + len += filename_len; /** * Alloc buffer for network binlog stream: @@ -4659,9 +4660,9 @@ uint32_t chksum; ptr = blr_build_header(resp, &hdr); /* Copy binlog name */ - memcpy(ptr, slave->binlogfile, BINLOG_FNAMELEN); + memcpy(ptr, slave->binlogfile, filename_len); - ptr += strlen(slave->binlogfile); + ptr += filename_len; /* Add the CRC32 */ if (!slave->nocrc)