Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
replace useless strncpy by a memcpy
authorAugustin Degomme <adegomme@gmail.com>
Tue, 14 May 2019 13:44:48 +0000 (15:44 +0200)
committerAugustin Degomme <adegomme@gmail.com>
Tue, 14 May 2019 13:45:15 +0000 (15:45 +0200)
src/smpi/bindings/smpi_pmpi.cpp

index b4a47dd..a20a5ff 100644 (file)
@@ -222,7 +222,7 @@ int PMPI_Error_string(int errorcode, char* string, int* resultlen){
       FOREACH_ERROR(GENERATE_STRING)
     };
     *resultlen = strlen(smpi_error_string[errorcode]);
       FOREACH_ERROR(GENERATE_STRING)
     };
     *resultlen = strlen(smpi_error_string[errorcode]);
-    strncpy(string, smpi_error_string[errorcode], *resultlen);
+    memcpy(string, smpi_error_string[errorcode], *resultlen*sizeof(char));
     return MPI_SUCCESS;  
   }
 }
     return MPI_SUCCESS;  
   }
 }