[MOAB-dev] r3436 - MOAB/trunk

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Tue Jan 19 12:07:21 CST 2010


Author: kraftche
Date: 2010-01-19 12:07:21 -0600 (Tue, 19 Jan 2010)
New Revision: 3436

Modified:
   MOAB/trunk/Tqdcfr.cpp
Log:
fix read past end of buffer in cub file reader

Modified: MOAB/trunk/Tqdcfr.cpp
===================================================================
--- MOAB/trunk/Tqdcfr.cpp	2010-01-19 14:39:34 UTC (rev 3435)
+++ MOAB/trunk/Tqdcfr.cpp	2010-01-19 18:07:21 UTC (rev 3436)
@@ -2111,6 +2111,7 @@
   unsigned int num_read;
   std::vector<std::string> attrib_vec;
   char temp_name[80];
+  char name_tag_val[NAME_TAG_SIZE];
   std::string name_tag;
   int id = -1;
   int uid = -1;
@@ -2222,7 +2223,10 @@
     }
     if (0 == entityNameTag) return MB_FAILURE;
 
-    result = mdbImpl->tag_set_data(entityNameTag, &(records[entity_rec_num].entity), 1, name_tag.c_str());
+    size_t len = name_tag.size();
+    memcpy( name_tag_val, name_tag.c_str(), len );
+    memset( name_tag_val+len, '\0', NAME_TAG_SIZE-len );
+    result = mdbImpl->tag_set_data(entityNameTag, &(records[entity_rec_num].entity), 1, name_tag_val);
     if (MB_SUCCESS != result) return result;
   }
 



More information about the moab-dev mailing list