[Groonga-mysql-commit] mroonga/mroonga [master] Eliminate the possibility of buffer overflow

Back to archive index

null+****@clear***** null+****@clear*****
2012年 6月 27日 (水) 19:18:49 JST


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$B$NE:IU%U%!%$%k$rJ]4I$7$^$7$?(B...
Download 



Groonga-mysql-commit メーリングリストの案内
Back to archive index