Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
.. and of strcat, replaced by strncat
authordegomme <augustin.degomme@unibas.ch>
Tue, 31 May 2016 23:32:50 +0000 (01:32 +0200)
committerdegomme <augustin.degomme@unibas.ch>
Tue, 31 May 2016 23:32:50 +0000 (01:32 +0200)
src/surf/surf_interface.cpp
tools/sg_unit_extractor.pl

index 952cf79..c48de1d 100644 (file)
@@ -229,8 +229,8 @@ int find_model_description(s_surf_model_description_t * table,
   name_list = xbt_strdup(table[0].name);
   for (i = 1; table[i].name; i++) {
     name_list = (char *) xbt_realloc(name_list, strlen(name_list) + strlen(table[i].name) + 3);
   name_list = xbt_strdup(table[0].name);
   for (i = 1; table[i].name; i++) {
     name_list = (char *) xbt_realloc(name_list, strlen(name_list) + strlen(table[i].name) + 3);
-    strcat(name_list, ", ");
-    strcat(name_list, table[i].name);
+    strncat(name_list, ", ", 2);
+    strncat(name_list, table[i].name, strlen(table[i].name));
   }
   xbt_die("Model '%s' is invalid! Valid models are: %s.", name, name_list);
   return -1;
   }
   xbt_die("Model '%s' is invalid! Valid models are: %s.", name, name_list);
   return -1;
index 2dee83a..4c0de32 100755 (executable)
@@ -151,8 +151,8 @@ int main(int argc, char *argv[]) {
         if (selection[0] == '\\0') {
           strcpy(selection, p);
         } else {
         if (selection[0] == '\\0') {
           strcpy(selection, p);
         } else {
-          strcat(selection, \",\");
-          strcat(selection, p);
+          strncat(selection, \",\",1);
+          strncat(selection, p, 1024);
         }
       } else if (!strcmp(argv[i], \"--verbose\")) {
         verbosity++;
         }
       } else if (!strcmp(argv[i], \"--verbose\")) {
         verbosity++;