ganapathi / rpms / mariadb

Forked from rpms/mariadb 4 years ago
Clone
Blob Blame History Raw
The following problems have been found by Coverity - static analysis tool.

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. 

diff -rup mariadb-5.5.47.covscan-stroverflow/sql/sp_rcontext.h mariadb-5.5.47/sql/sp_rcontext.h
--- mariadb-5.5.47.covscan-stroverflow/sql/sp_rcontext.h	2015-12-09 18:22:47.000000000 +0100
+++ mariadb-5.5.47/sql/sp_rcontext.h	2016-02-04 07:55:50.073558349 +0100
@@ -84,7 +84,8 @@ public:
     memcpy(m_sql_state, sqlstate, SQLSTATE_LENGTH);
     m_sql_state[SQLSTATE_LENGTH]= '\0';
 
-    strncpy(m_message, msg, MYSQL_ERRMSG_SIZE);
+    strncpy(m_message, msg, sizeof(m_message)-1);
+    m_message[sizeof(m_message)-1] = '\0';
   }
 
   void clear()