From nobody Fri May 10 16:41:40 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VbZQr6Jt2z5K2P2; Fri, 10 May 2024 16:41:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VbZQr40Qsz44m2; Fri, 10 May 2024 16:41:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715359300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmHXQD5y9CQ5zPPyhNBk+1wlIADeXeGjLhTHDmB1HuU=; b=mJw6WncUiuRS82uxt5OlbkXBB6wJVopostVeVVQnYhfCgmCk0xZH+v2ZYx5QojPdrY9x7N ecOCe9WV0w1j+jeIQ+KUcJ42EVqMnXvgNawUgPB7qEtSFpbSFr6isYDr67uNl45aSEDACS O+WRAXqKKHkk3GqAgNB6I++hqGHEntrhJqZsIA5rEQTvIXxqRE4UuH0c4nlsxKqu8FZCzd KVRUK2iBzd86IlEMxzcWA6R+8R6WkhAgiyxYaLIqZsQniXM0q8Iv91S7893X+OP5gKBYqc WNY+RO+ceD4wuz6Crt7HwhfCFoDLtlpSAoRUlunbpT1rI/X5wnaEgFGgPwXxUg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715359300; a=rsa-sha256; cv=none; b=JNYB17rDC2jCmJlXPc9A0c3LdH2nl1ZCL1Id+/dwhN1pERdGs82zS5FtV7jla67TnrO1G5 uHs0pnNgJj8TIK6njYt7SlMmIlmh1TDZOvRsJ+zy9zWMV0wkJka3FyQiXgNamgshmpWt/w AIFxOVY9WyupKs2NxO6ujcYjt/aWJ8vQjJlgC0zwyNFcwd2P0YBNRnwG8UAkV0eMWwzz8E Jm1dlSHYYdq8rCTVoPvQ209MVUCHvuqsI/F0sQ8dF8BTSlNMteHKL3ZweRhQ1Ixw2lvhjN dlQS0nx9puIq6gmk+qb1binSzP6UVrpoxJfloDTfqWeDxEHSRjrP773I2IAPBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715359300; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bmHXQD5y9CQ5zPPyhNBk+1wlIADeXeGjLhTHDmB1HuU=; b=fxWTWead86wyaQO+XjO7wB/HhtsClcTw1/Dqe2i2N+92R1JFXpz/mnPWhAcTDKMxiNDkmJ E7azEfnCVoFDposyUetFYcYy7bQKqPH3OubvkTwuf9B5HJ0yL8vJH7hEgDAsxGKUAH/3Rm TAMKjAgPbUlqN4EQq7QYjyctQDguePaVXlOpx9xHoAWl3hIWCY7r72sF+J0p7zLKI/d+KI GGulMUlNjJwzNvhKYPdKZiD5oC3MLQ0r+sQSiYlvxk6OhUFsmCMbafbbDQ7xVSP73SvBt5 fKsw1wv7GmSeHyhYhSoy54hNQzEVOP+mgdmstT7Wtnu5MGuER1FSjGFgbiFZmA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VbZQr3chczlfL; Fri, 10 May 2024 16:41:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44AGfeDs017938; Fri, 10 May 2024 16:41:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44AGfewU017935; Fri, 10 May 2024 16:41:40 GMT (envelope-from git) Date: Fri, 10 May 2024 16:41:40 GMT Message-Id: <202405101641.44AGfewU017935@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: 1f029b86bbe1 - main - nvmf: Use strlcpy instead of strncpy to ensure termination List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 1f029b86bbe11ba6e4bae2392920346817933df0 Auto-Submitted: auto-generated The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=1f029b86bbe11ba6e4bae2392920346817933df0 commit 1f029b86bbe11ba6e4bae2392920346817933df0 Author: John Baldwin AuthorDate: 2024-05-10 15:56:51 +0000 Commit: John Baldwin 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;