Commit 6ec6eda4 authored by Marko Mäkelä's avatar Marko Mäkelä

Do not compare uninitialized data

Valgrind only seems to complain about memcmp() operations that
actually end up reading uninitialized data, while MemorySanitizer
requires that the entire length of both buffers be defined.
parent 3a1c8971
......@@ -10867,7 +10867,7 @@ REPLACE *init_replace(char * *from, char * *to,uint count,
for (i=1 ; i <= found_sets ; i++)
{
pos=from[found_set[i-1].table_offset];
rep_str[i].found= !memcmp(pos, "\\^", 3) ? 2 : 1;
rep_str[i].found= !strncmp(pos, "\\^", 3) ? 2 : 1;
rep_str[i].replace_string=to_array[found_set[i-1].table_offset];
rep_str[i].to_offset=found_set[i-1].found_offset-start_at_word(pos);
rep_str[i].from_offset=found_set[i-1].found_offset-replace_len(pos)+
......
......@@ -59,6 +59,7 @@ int wsrep_is_wsrep_xid(const void* xid_ptr)
const XID* xid= static_cast<const XID*>(xid_ptr);
return (xid->formatID == 1 &&
xid->bqual_length == 0 &&
xid->gtrid_length >= static_cast<long>(WSREP_XID_GTRID_LEN_V_1_2) &&
!memcmp(xid->data, WSREP_XID_PREFIX, WSREP_XID_PREFIX_LEN) &&
(((xid->data[WSREP_XID_VERSION_OFFSET] == WSREP_XID_VERSION_1 ||
xid->data[WSREP_XID_VERSION_OFFSET] == WSREP_XID_VERSION_2) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment