Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Ensure that the terminating nul byte is also copied.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 1 Jun 2018 13:27:12 +0000 (15:27 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 1 Jun 2018 13:33:33 +0000 (15:33 +0200)
src/smpi/mpi/smpi_comm.cpp
src/xbt/backtrace_linux.cpp

index 98a41c8..58dd774 100644 (file)
@@ -120,7 +120,7 @@ void Comm::get_name (char* name, int* len)
     return;
   }
   if(this == MPI_COMM_WORLD) {
-    strncpy(name, "WORLD",5);
+    strncpy(name, "WORLD", 6);
     *len = 5;
   } else {
     *len = snprintf(name, MPI_MAX_NAME_STRING, "%p", this);
index abedb81..5df45b9 100644 (file)
@@ -200,7 +200,7 @@ std::vector<std::string> resolveBacktrace(
       line_func[strlen(line_func) - 1] = '\0';
     } else {
       XBT_VERB("Cannot run fgets to look for symbol %zu, addr %s", i, addrs[i].c_str());
-      strncpy(line_func, "???",3);
+      strncpy(line_func, "???", 4);
     }
     if (fgets(line_pos, 1024, pipe)) {
       line_pos[strlen(line_pos) - 1] = '\0';
@@ -295,7 +295,7 @@ std::vector<std::string> resolveBacktrace(
           line_func[strlen(line_func) - 1] = '\0';
         } else {
           XBT_VERB("Cannot read result of subcommand %s", subcmd.c_str());
-          strncpy(line_func, "???",3);
+          strncpy(line_func, "???", 4);
         }
         if (fgets(line_pos, 1024, subpipe)) {
           line_pos[strlen(line_pos) - 1] = '\0';