nvmf: Use strlcpy instead of strncpy to ensure termination

Reported by:	Coverity Scan
CID:	 	1545054
Sponsored by:	Chelsio Communications
This commit is contained in:
John Baldwin 2024-05-10 08:56:51 -07:00
parent bf1820f187
commit 1f029b86bb

View File

@ -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;