af63a8b
The following problems have been found by Coverity - static analysis tool.
af63a8b
af63a8b
mysql-5.5.31/plugin/semisync/semisync_master.cc:672:parameter_as_source – Note: This defect has an elevated risk because the source argument is a parameter of the current function. 
af63a8b
af63a8b
mysql-5.5.31/plugin/semisync/semisync_master.cc:661:parameter_as_source – Note: This defect has an elevated risk because the source argument is a parameter of the current function. 
af63a8b
af63a8b
mysql-5.5.31/plugin/semisync/semisync_master.cc:555:parameter_as_source – Note: This defect has an elevated risk because the source argument is a parameter of the current function.
af63a8b
Jakub Dorňák 6aba9be
diff -up mariadb-10.0.10/plugin/semisync/semisync_master.cc.p12 mariadb-10.0.10/plugin/semisync/semisync_master.cc
Jakub Dorňák 6aba9be
--- mariadb-10.0.10/plugin/semisync/semisync_master.cc.p12	2014-03-30 19:56:37.000000000 +0200
Jakub Dorňák 6aba9be
+++ mariadb-10.0.10/plugin/semisync/semisync_master.cc	2014-04-07 20:02:49.614944992 +0200
Jakub Dorňák 6aba9be
@@ -553,7 +553,8 @@ int ReplSemiSyncMaster::reportReplyBinlo
af63a8b
 
af63a8b
   if (need_copy_send_pos)
af63a8b
   {
af63a8b
-    strcpy(reply_file_name_, log_file_name);
af63a8b
+    strncpy(reply_file_name_, log_file_name, sizeof(reply_file_name_)-1);
af63a8b
+    reply_file_name_[sizeof(reply_file_name_)-1] = '\0';
af63a8b
     reply_file_pos_ = log_file_pos;
af63a8b
     reply_file_name_inited_ = true;
af63a8b
 
Jakub Dorňák 6aba9be
@@ -661,7 +662,8 @@ int ReplSemiSyncMaster::commitTrx(const
af63a8b
         if (cmp <= 0)
af63a8b
 	{
af63a8b
           /* This thd has a lower position, let's update the minimum info. */
af63a8b
-          strcpy(wait_file_name_, trx_wait_binlog_name);
af63a8b
+          strncpy(wait_file_name_, trx_wait_binlog_name, sizeof(wait_file_name_)-1);
af63a8b
+          wait_file_name_[sizeof(wait_file_name_)-1] = '\0';
af63a8b
           wait_file_pos_ = trx_wait_binlog_pos;
af63a8b
 
af63a8b
           rpl_semi_sync_master_wait_pos_backtraverse++;
Jakub Dorňák 6aba9be
@@ -672,7 +674,8 @@ int ReplSemiSyncMaster::commitTrx(const
af63a8b
       }
af63a8b
       else
af63a8b
       {
af63a8b
-        strcpy(wait_file_name_, trx_wait_binlog_name);
af63a8b
+        strncpy(wait_file_name_, trx_wait_binlog_name, sizeof(wait_file_name_)-1);
af63a8b
+        wait_file_name_[sizeof(wait_file_name_)-1] = '\0';
af63a8b
         wait_file_pos_ = trx_wait_binlog_pos;
af63a8b
         wait_file_name_inited_ = true;
af63a8b
 
af63a8b
af63a8b
mysql-5.5.31/sql/rpl_handler.cc:306:fixed_size_dest – You might overrun the 512 byte fixed-size string "log_info->log_file" by copying "log_file + dirname_length(log_file)" without checking the length. diff -up mysql-5.5.31/sql/rpl_handler.cc.covscan-stroverflow mysql-5.5.31/sql/rpl_handler.cc
af63a8b
Jakub Dorňák 6aba9be
--- mariadb-10.0.10/sql/rpl_handler.cc.p12	2014-03-30 19:56:34.000000000 +0200
Jakub Dorňák 6aba9be
+++ mariadb-10.0.10/sql/rpl_handler.cc	2014-04-07 20:07:58.851123497 +0200
af63a8b
@@ -303,7 +303,8 @@ int Binlog_storage_delegate::after_flush
af63a8b
     my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, log_info);
af63a8b
   }
af63a8b
     
af63a8b
-  strcpy(log_info->log_file, log_file+dirname_length(log_file));
af63a8b
+  strncpy(log_info->log_file, log_file+dirname_length(log_file), sizeof(log_info->log_file)-1);
af63a8b
+  log_info->log_file[sizeof(log_info->log_file)-1] = '\0';
af63a8b
   log_info->log_pos = log_pos;
af63a8b
   
af63a8b
   int ret= 0;