Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
use strncpy instead of strcpy to please sonar
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 4 Jan 2019 16:43:22 +0000 (17:43 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Fri, 4 Jan 2019 16:43:22 +0000 (17:43 +0100)
src/smpi/internals/smpi_global.cpp

index 4aea1a5..be68fe1 100644 (file)
@@ -563,7 +563,7 @@ static void smpi_init_privatization_dlopen(const std::string& executable)
       void* libhandle = dlopen(libname.c_str(), RTLD_LAZY);
       // get library name from path
       char fullpath[512] = {'\0'};
-      strcpy(fullpath, libname.c_str());
+      strncpy(fullpath, libname.c_str(), 511);
 #if not defined(__APPLE__)
       int ret = dl_iterate_phdr(visit_libs, fullpath);
       if (ret == 0)