diff --git a/src/plugins/mpi/pmi2/info.c b/src/plugins/mpi/pmi2/info.c index 459485d8065482a72f5e5f520681a68696b9df5f..5e101ba6f5dff170fc0195171d91a06a2d673910 100644 --- a/src/plugins/mpi/pmi2/info.c +++ b/src/plugins/mpi/pmi2/info.c @@ -51,6 +51,7 @@ #include <unistd.h> #include "slurm/slurm.h" #include "src/srun/libsrun/launch.h" +#include "src/common/strlcpy.h" #include "src/common/switch.h" #include "src/common/slurm_protocol_api.h" #include "src/common/xmalloc.h" @@ -84,7 +85,7 @@ enqueue_nag_req(int fd, int rank, char *key) req = xmalloc(sizeof(nag_req_t)); req->fd = fd; req->rank = rank; - strncpy(req->key, key, (PMI2_MAX_KEYLEN - 1)); /* Insure NULL at end */ + strlcpy(req->key, key, PMI2_MAX_KEYLEN); /* insert in the head */ req->next = nag_req_list;