Fixed invalid writes/reads in 'update_group_replication_set_writer' due to query not fitting allocated buffer

pull/3286/head
Javier Jaramago Fernández 5 years ago committed by René Cannaò
parent 419e239da8
commit 23843ed6ee

@ -4699,6 +4699,8 @@ void MySQL_HostGroups_Manager::update_group_replication_set_writer(char *_hostna
//free(query);
if (writer_is_also_reader && read_HG>=0) {
q=(char *)"INSERT OR IGNORE INTO mysql_servers_incoming (hostgroup_id,hostname,port,gtid_port,status,weight,compression,max_connections,max_replication_lag,use_ssl,max_latency_ms,comment) SELECT %d,hostname,port,gtid_port,status,weight,compression,max_connections,max_replication_lag,use_ssl,max_latency_ms,comment FROM mysql_servers_incoming WHERE hostgroup_id=%d AND hostname='%s' AND port=%d";
free(query);
query=(char *)malloc(strlen(q)+strlen(_hostname)+256);
sprintf(query,q,read_HG,_writer_hostgroup,_hostname,_port);
mydb->execute(query);
}

Loading…
Cancel
Save