Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use memcpy instead of strncpy.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 1 Jun 2018 13:41:18 +0000 (15:41 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Fri, 1 Jun 2018 13:41:18 +0000 (15:41 +0200)
Fix build error with gcc 8.1:
error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]

src/xbt/RngStream.c

index f1420ff..b3c1fbe 100644 (file)
@@ -287,7 +287,7 @@ RngStream RngStream_CreateStream (const char name[])
    if (name) {
       len = strlen (name);
       g->name = (char *) xbt_malloc ((len + 1) * sizeof (char));
-      strncpy (g->name, name, len + 1);
+      memcpy(g->name, name, len + 1);
    } else
       g->name = 0;
    g->Anti = 0;