[MOAB-dev] r1670 - MOAB/trunk/parallel

kraftche at mcs.anl.gov kraftche at mcs.anl.gov
Mon Mar 17 12:43:24 CDT 2008


Author: kraftche
Date: 2008-03-17 12:43:24 -0500 (Mon, 17 Mar 2008)
New Revision: 1670

Modified:
   MOAB/trunk/parallel/MBParallelComm.cpp
Log:
fix possible buffer overflow

Modified: MOAB/trunk/parallel/MBParallelComm.cpp
===================================================================
--- MOAB/trunk/parallel/MBParallelComm.cpp	2008-03-17 17:09:49 UTC (rev 1669)
+++ MOAB/trunk/parallel/MBParallelComm.cpp	2008-03-17 17:43:24 UTC (rev 1670)
@@ -927,7 +927,7 @@
   }
 
   else {
-    static std::vector<int> tag_data;
+    std::vector<unsigned char> tag_data;
     std::vector<MBRange>::const_iterator tr_it = tagRanges.begin();
 
     PACK_INT(buff_ptr, allTags.size());
@@ -955,7 +955,7 @@
         // name
       PACK_CHAR_64(buff_ptr, tinfo->get_name().c_str());
       
-      tag_data.resize((tr_it->size()+1) * tinfo->get_size() / sizeof(int));
+      tag_data.resize(tr_it->size() * tinfo->get_size());
       result = mbImpl->tag_get_data(*tag_it, *tr_it, &tag_data[0]);
       RR("Failed to get tag data in pack_tags.");
       PACK_RANGE(buff_ptr, (*tr_it));
@@ -982,7 +982,6 @@
   
   int num_tags;
   UNPACK_INT(buff_ptr, num_tags);
-  std::vector<int> tag_data;
   std::vector<MBEntityHandle> tag_ents;
 
   for (int i = 0; i < num_tags; i++) {




More information about the moab-dev mailing list