[MOAB-dev] r5291 - MOAB/trunk/examples/itaps

jvporter at wisc.edu jvporter at wisc.edu
Fri Jan 6 12:08:23 CST 2012


Author: jvporter
Date: 2012-01-06 12:08:22 -0600 (Fri, 06 Jan 2012)
New Revision: 5291

Modified:
   MOAB/trunk/examples/itaps/ListSetsNTagsCXX.cpp
Log:
Fix buffer overrun in example


Modified: MOAB/trunk/examples/itaps/ListSetsNTagsCXX.cpp
===================================================================
--- MOAB/trunk/examples/itaps/ListSetsNTagsCXX.cpp	2012-01-06 17:58:53 UTC (rev 5290)
+++ MOAB/trunk/examples/itaps/ListSetsNTagsCXX.cpp	2012-01-06 18:08:22 UTC (rev 5291)
@@ -71,10 +71,9 @@
       for (j = 0; j < tags_size; j++) {
         char tname[128];
         std::vector<int> int_val;
-        int tname_size = 128;
         std::vector<double> dbl_val;
-        iMesh_getTagName(mesh, tags[j], tname, &err, tname_size);
-        tname[tname_size] = '\0';
+        iMesh_getTagName(mesh, tags[j], tname, &err, sizeof(tname));
+        tname[sizeof(tname)-1] = '\0';
         int tag_type, tag_size;
         iMesh_getTagType(mesh, tags[j], &tag_type, &err);
         ERRORR("Failed to get tag type.");




































More information about the moab-dev mailing list