Date: Mon, 13 May 2024 19:04:19 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: 01fc488381e9 - main - nvme: Use strlcpy instead of strncpy to ensure termination Message-ID: <202405131904.44DJ4Jre001258@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=01fc488381e97c0bf589a297caa0c4b8e6b3e1c4 commit 01fc488381e97c0bf589a297caa0c4b8e6b3e1c4 Author: John Baldwin <jhb@FreeBSD.org> AuthorDate: 2024-05-13 19:03:49 +0000 Commit: John Baldwin <jhb@FreeBSD.org> CommitDate: 2024-05-13 19:03:49 +0000 nvme: Use strlcpy instead of strncpy to ensure termination Reviewed by: dab, imp Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D45152 --- sys/dev/nvme/nvme_sim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sys/dev/nvme/nvme_sim.c b/sys/dev/nvme/nvme_sim.c index f561756f99b7..2ba3df9ea6e8 100644 --- a/sys/dev/nvme/nvme_sim.c +++ b/sys/dev/nvme/nvme_sim.c @@ -203,7 +203,7 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb) cpi->xport_specific.nvme.slot = pci_get_slot(dev); cpi->xport_specific.nvme.function = pci_get_function(dev); cpi->xport_specific.nvme.extra = 0; - strncpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(dev), + strlcpy(cpi->xport_specific.nvme.dev_name, device_get_nameunit(dev), sizeof(cpi->xport_specific.nvme.dev_name)); cpi->hba_vendor = pci_get_vendor(dev); cpi->hba_device = pci_get_device(dev);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202405131904.44DJ4Jre001258>