ganapathi / rpms / mariadb

Forked from rpms/mariadb 3 years ago
Clone

Blame SOURCES/mariadb-covscan-stroverflow.patch

031387
The following problems have been found by Coverity - static analysis tool.
031387
031387
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. 
031387
031387
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. 
031387
031387
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.
031387
ca2eb8
diff -rup mariadb-5.5.47.covscan-stroverflow/plugin/semisync/semisync_master.cc mariadb-5.5.47/plugin/semisync/semisync_master.cc
ca2eb8
--- mariadb-5.5.47.covscan-stroverflow/plugin/semisync/semisync_master.cc	2015-12-09 18:22:47.000000000 +0100
ca2eb8
+++ mariadb-5.5.47/plugin/semisync/semisync_master.cc	2016-02-04 07:51:02.023858249 +0100
031387
@@ -552,7 +552,8 @@ int ReplSemiSyncMaster::reportReplyBinlo
031387
 
031387
   if (need_copy_send_pos)
031387
   {
031387
-    strcpy(reply_file_name_, log_file_name);
031387
+    strncpy(reply_file_name_, log_file_name, sizeof(reply_file_name_)-1);
031387
+    reply_file_name_[sizeof(reply_file_name_)-1] = '\0';
031387
     reply_file_pos_ = log_file_pos;
031387
     reply_file_name_inited_ = true;
031387
 
ca2eb8
@@ -659,7 +660,8 @@ int ReplSemiSyncMaster::commitTrx(const
031387
         if (cmp <= 0)
031387
 	{
031387
           /* This thd has a lower position, let's update the minimum info. */
031387
-          strcpy(wait_file_name_, trx_wait_binlog_name);
031387
+          strncpy(wait_file_name_, trx_wait_binlog_name, sizeof(wait_file_name_)-1);
031387
+          wait_file_name_[sizeof(wait_file_name_)-1] = '\0';
031387
           wait_file_pos_ = trx_wait_binlog_pos;
031387
 
031387
           rpl_semi_sync_master_wait_pos_backtraverse++;
ca2eb8
@@ -670,7 +672,8 @@ int ReplSemiSyncMaster::commitTrx(const
031387
       }
031387
       else
031387
       {
031387
-        strcpy(wait_file_name_, trx_wait_binlog_name);
031387
+        strncpy(wait_file_name_, trx_wait_binlog_name, sizeof(wait_file_name_)-1);
031387
+        wait_file_name_[sizeof(wait_file_name_)-1] = '\0';
031387
         wait_file_pos_ = trx_wait_binlog_pos;
031387
         wait_file_name_inited_ = true;
031387
 
031387
031387
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
031387
ca2eb8
diff -rup mariadb-5.5.47.covscan-stroverflow/sql/rpl_handler.cc mariadb-5.5.47/sql/rpl_handler.cc
ca2eb8
--- mariadb-5.5.47.covscan-stroverflow/sql/rpl_handler.cc	2015-12-09 18:22:47.000000000 +0100
ca2eb8
+++ mariadb-5.5.47/sql/rpl_handler.cc	2016-02-04 07:53:11.920729054 +0100
ca2eb8
@@ -260,7 +260,8 @@ int Binlog_storage_delegate::after_flush
ca2eb8
     thd->semisync_info= log_info;
031387
   }
ca2eb8
 
031387
-  strcpy(log_info->log_file, log_file+dirname_length(log_file));
031387
+  strncpy(log_info->log_file, log_file+dirname_length(log_file), sizeof(log_info->log_file)-1);
031387
+  log_info->log_file[sizeof(log_info->log_file)-1] = '\0';
031387
   log_info->log_pos = log_pos;
031387
   
ca2eb8
   FOREACH_OBSERVER(ret, after_flush, false,
031387
031387
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. 
031387
ca2eb8
diff -rup mariadb-5.5.47.covscan-stroverflow/sql/sp_rcontext.h mariadb-5.5.47/sql/sp_rcontext.h
ca2eb8
--- mariadb-5.5.47.covscan-stroverflow/sql/sp_rcontext.h	2015-12-09 18:22:47.000000000 +0100
ca2eb8
+++ mariadb-5.5.47/sql/sp_rcontext.h	2016-02-04 07:55:50.073558349 +0100
031387
@@ -84,7 +84,8 @@ public:
031387
     memcpy(m_sql_state, sqlstate, SQLSTATE_LENGTH);
031387
     m_sql_state[SQLSTATE_LENGTH]= '\0';
031387
 
031387
-    strncpy(m_message, msg, MYSQL_ERRMSG_SIZE);
031387
+    strncpy(m_message, msg, sizeof(m_message)-1);
031387
+    m_message[sizeof(m_message)-1] = '\0';
031387
   }
031387
 
031387
   void clear()