[Groonga-mysql-commit] mroonga/mroonga [fix-for-visual-studio] Eliminate the possibility of buffer overflow

Back to archive index

HAYASHI Kentaro null+****@clear*****
Thu Oct 4 10:44:03 JST 2012


HAYASHI Kentaro	2012-06-27 19:18:49 +0900 (Wed, 27 Jun 2012)

  New Revision: 4cca9e50d9f5be8118dfadd7fce0a2e3fcbfc5da
  https://github.com/mroonga/mroonga/commit/4cca9e50d9f5be8118dfadd7fce0a2e3fcbfc5da

  Log:
    Eliminate the possibility of buffer overflow

  Modified files:
    lib/mrn_path_mapper.cpp

  Modified: lib/mrn_path_mapper.cpp (+2 -1)
===================================================================
--- lib/mrn_path_mapper.cpp    2012-06-27 16:07:08 +0900 (fe867fa)
+++ lib/mrn_path_mapper.cpp    2012-06-27 19:18:49 +0900 (086cba6)
@@ -48,9 +48,10 @@ namespace mrn {
       return db_path_;
     }
 
+    size_t db_len = strlen(db_path_);
     if (strncmp(mysql_path_, "./", 2) == 0) {
       if (path_prefix_) {
-        strncat(db_path_, path_prefix_, MRN_MAX_PATH_SIZE);
+        strncat(db_path_, path_prefix_, MRN_MAX_PATH_SIZE - db_len - 1);
       }
 
       int i = 2, j = strlen(db_path_), len;
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-mysql-commit mailing list
Back to archive index