[Commits] 8b51bac: MDEV-10735: Valgrind warnings around Galera SST

Nirbhay Choubey nirbhay at mariadb.com
Wed Sep 21 04:32:57 EEST 2016


revision-id: 8b51bacfd63ffcffa06e2815dd5ee72a45b5de79 (mariadb-10.1.17-12-g8b51bac)
parent(s): 6eca463cae8e2e61469fcefa227acd4ae7b771c8
author: Nirbhay Choubey
committer: Nirbhay Choubey
timestamp: 2016-09-20 21:32:53 -0400
message:

MDEV-10735: Valgrind warnings around Galera SST

While copying the received state Id (uuid:seqno) to an uninitialized
buffer, it was not properly null-terminated.

---
 sql/wsrep_sst.cc | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc
index d88263d..7c36643 100644
--- a/sql/wsrep_sst.cc
+++ b/sql/wsrep_sst.cc
@@ -476,13 +476,11 @@ static void* sst_joiner_thread (void* a)
 
       } else {
         // Scan state ID first followed by wsrep_gtid_domain_id.
-        char uuid[512];
         unsigned long int domain_id;
-        size_t len= pos - out + 1;
 
-        if (len > sizeof(uuid)) goto err;       // safety check
-        memcpy(uuid, out, len);                 // including '\0'
-        err= sst_scan_uuid_seqno (uuid, &ret_uuid, &ret_seqno);
+        // Null-terminate the state-id.
+        out[pos - out]= 0;
+        err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno);
 
         if (err)
         {


More information about the commits mailing list