From 1f029b86bbe11ba6e4bae2392920346817933df0 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 10 May 2024 08:56:51 -0700 Subject: [PATCH] nvmf: Use strlcpy instead of strncpy to ensure termination Reported by: Coverity Scan CID: 1545054 Sponsored by: Chelsio Communications --- sys/dev/nvmf/host/nvmf_sim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/nvmf/host/nvmf_sim.c b/sys/dev/nvmf/host/nvmf_sim.c index b097b04d64c3..00dad07889d1 100644 --- a/sys/dev/nvmf/host/nvmf_sim.c +++ b/sys/dev/nvmf/host/nvmf_sim.c @@ -183,7 +183,7 @@ nvmf_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.nvmf.nsid = xpt_path_lun_id(ccb->ccb_h.path); cpi->xport_specific.nvmf.trtype = sc->trtype; - strncpy(cpi->xport_specific.nvmf.dev_name, + strlcpy(cpi->xport_specific.nvmf.dev_name, device_get_nameunit(sc->dev), sizeof(cpi->xport_specific.nvmf.dev_name)); cpi->maxio = sc->max_xfer_size;