jjanco / rpms / mariadb

Forked from rpms/mariadb 6 years ago
Clone
e1a5cda
The following problems have been found by Coverity - static analysis tool.
e1a5cda
e1a5cda
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. 
e1a5cda
e1a5cda
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. 
e1a5cda
e1a5cda
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.
e1a5cda
e1a5cda
diff -up mysql-5.5.31/plugin/semisync/semisync_master.cc.covscan-stroverflow mysql-5.5.31/plugin/semisync/semisync_master.cc
e1a5cda
--- mysql-5.5.31/plugin/semisync/semisync_master.cc.covscan-stroverflow	2013-06-17 09:04:47.214621154 +0200
e1a5cda
+++ mysql-5.5.31/plugin/semisync/semisync_master.cc	2013-06-17 09:08:32.189617218 +0200
e1a5cda
@@ -552,7 +552,8 @@ int ReplSemiSyncMaster::reportReplyBinlo
e1a5cda
 
e1a5cda
   if (need_copy_send_pos)
e1a5cda
   {
e1a5cda
-    strcpy(reply_file_name_, log_file_name);
e1a5cda
+    strncpy(reply_file_name_, log_file_name, sizeof(reply_file_name_)-1);
e1a5cda
+    reply_file_name_[sizeof(reply_file_name_)-1] = '\0';
e1a5cda
     reply_file_pos_ = log_file_pos;
e1a5cda
     reply_file_name_inited_ = true;
e1a5cda
 
e1a5cda
@@ -658,7 +659,8 @@ int ReplSemiSyncMaster::commitTrx(const
e1a5cda
         if (cmp <= 0)
e1a5cda
 	{
e1a5cda
           /* This thd has a lower position, let's update the minimum info. */
e1a5cda
-          strcpy(wait_file_name_, trx_wait_binlog_name);
e1a5cda
+          strncpy(wait_file_name_, trx_wait_binlog_name, sizeof(wait_file_name_)-1);
e1a5cda
+          wait_file_name_[sizeof(wait_file_name_)-1] = '\0';
e1a5cda
           wait_file_pos_ = trx_wait_binlog_pos;
e1a5cda
 
e1a5cda
           rpl_semi_sync_master_wait_pos_backtraverse++;
e1a5cda
@@ -669,7 +671,8 @@ int ReplSemiSyncMaster::commitTrx(const
e1a5cda
       }
e1a5cda
       else
e1a5cda
       {
e1a5cda
-        strcpy(wait_file_name_, trx_wait_binlog_name);
e1a5cda
+        strncpy(wait_file_name_, trx_wait_binlog_name, sizeof(wait_file_name_)-1);
e1a5cda
+        wait_file_name_[sizeof(wait_file_name_)-1] = '\0';
e1a5cda
         wait_file_pos_ = trx_wait_binlog_pos;
e1a5cda
         wait_file_name_inited_ = true;
e1a5cda
 
e1a5cda
e1a5cda
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
e1a5cda
e1a5cda
--- mysql-5.5.31/sql/rpl_handler.cc.covscan-stroverflow	2013-06-17 10:51:04.940509594 +0200
e1a5cda
+++ mysql-5.5.31/sql/rpl_handler.cc	2013-06-17 10:51:08.959509523 +0200
e1a5cda
@@ -303,7 +303,8 @@ int Binlog_storage_delegate::after_flush
e1a5cda
     my_pthread_setspecific_ptr(RPL_TRANS_BINLOG_INFO, log_info);
e1a5cda
   }
e1a5cda
     
e1a5cda
-  strcpy(log_info->log_file, log_file+dirname_length(log_file));
e1a5cda
+  strncpy(log_info->log_file, log_file+dirname_length(log_file), sizeof(log_info->log_file)-1);
e1a5cda
+  log_info->log_file[sizeof(log_info->log_file)-1] = '\0';
e1a5cda
   log_info->log_pos = log_pos;
e1a5cda
   
e1a5cda
   int ret= 0;
e1a5cda
e1a5cda
e1a5cda
mysql-5.5.31/sql/sp_rcontext.h:87:buffer_size_warning – Calling strncpy with a maximum size argument of 512 bytes on destination array "this->m_message" of size 512 bytes might leave the destination string unterminated. 
e1a5cda
e1a5cda
diff -up mysql-5.5.31/sql/sp_rcontext.h.covscan-stroverflow mysql-5.5.31/sql/sp_rcontext.h
e1a5cda
--- mysql-5.5.31/sql/sp_rcontext.h.covscan-stroverflow	2013-06-17 13:28:32.540344334 +0200
e1a5cda
+++ mysql-5.5.31/sql/sp_rcontext.h	2013-06-17 13:29:23.673343443 +0200
e1a5cda
@@ -84,7 +84,8 @@ public:
e1a5cda
     memcpy(m_sql_state, sqlstate, SQLSTATE_LENGTH);
e1a5cda
     m_sql_state[SQLSTATE_LENGTH]= '\0';
e1a5cda
 
e1a5cda
-    strncpy(m_message, msg, MYSQL_ERRMSG_SIZE);
e1a5cda
+    strncpy(m_message, msg, sizeof(m_message)-1);
e1a5cda
+    m_message[sizeof(m_message)-1] = '\0';
e1a5cda
   }
e1a5cda
 
e1a5cda
   void clear()