@@ -557,7 +557,8 @@ int ReplSemiSyncMaster::reportReplyBinlog(uint32 server_id,
557557
558558 if (need_copy_send_pos)
559559 {
560- strcpy (reply_file_name_, log_file_name);
560+ strncpy (reply_file_name_, log_file_name, sizeof (reply_file_name_) - 1 );
561+ reply_file_name_[sizeof (reply_file_name_) - 1 ]= ' \0 ' ;
561562 reply_file_pos_ = log_file_pos;
562563 reply_file_name_inited_ = true ;
563564
@@ -685,7 +686,8 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
685686 if (cmp <= 0 )
686687 {
687688 /* This thd has a lower position, let's update the minimum info. */
688- strcpy (wait_file_name_, trx_wait_binlog_name);
689+ strncpy (wait_file_name_, trx_wait_binlog_name, sizeof (wait_file_name_) - 1 );
690+ wait_file_name_[sizeof (wait_file_name_) - 1 ]= ' \0 ' ;
689691 wait_file_pos_ = trx_wait_binlog_pos;
690692
691693 rpl_semi_sync_master_wait_pos_backtraverse++;
@@ -696,7 +698,8 @@ int ReplSemiSyncMaster::commitTrx(const char* trx_wait_binlog_name,
696698 }
697699 else
698700 {
699- strcpy (wait_file_name_, trx_wait_binlog_name);
701+ strncpy (wait_file_name_, trx_wait_binlog_name, sizeof (wait_file_name_) - 1 );
702+ wait_file_name_[sizeof (wait_file_name_) - 1 ]= ' \0 ' ;
700703 wait_file_pos_ = trx_wait_binlog_pos;
701704 wait_file_name_inited_ = true ;
702705
0 commit comments