Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 10 May 2024 16:41:40 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 1f029b86bbe1 - main - nvmf: Use strlcpy instead of strncpy to ensure termination
Message-ID:  <202405101641.44AGfewU017935@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405101641.44AGfewU017935>