git: 1f029b86bbe1 - main - nvmf: Use strlcpy instead of strncpy to ensure termination
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 10 May 2024 16:41:40 UTC
The branch main has been updated by jhb:
URL: https://cgit.FreeBSD.org/src/commit/?id=1f029b86bbe11ba6e4bae2392920346817933df0
commit 1f029b86bbe11ba6e4bae2392920346817933df0
Author: John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2024-05-10 15:56:51 +0000
Commit: John Baldwin <jhb@FreeBSD.org>
CommitDate: 2024-05-10 15:56:51 +0000
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;