From nobody Thu Jan 26 18:54:29 2023 X-Original-To: dev-commits-src-all@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 4P2qd23c9Gz3bPFZ; Thu, 26 Jan 2023 18:54:30 +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 4P2qd20Jyqz46FM; Thu, 26 Jan 2023 18:54:30 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674759270; 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=KOLYbqN8AAzXrJw41jLPvEj7d4G3jczP3YZrQZjqBu0=; b=mVUWrudcD14qVLmK/v5VM10Hq+ol0qAvm5wb4luBqgF53lMbqxmNF+8uq0YAisLvaRLvGH 6cj/1YkIKqdycqEukXqm8iz78pv5Ej5BDi4R5F0IPHxI3RWSDARUOccH56FGBk2CQpiqY/ hBGvxVANQTe4oIYEc10Pg70G5RS3RCDogyQLE7TFT963P+N1Wf2jmWu4cH5aJCKMA0mDOF Pz/k4c/u/auWA0i9f8LCWxuQQtZ/aiVX2pYcJ2ec1l6ApR/R6V8PXnwKm9+I9jZ2CJlIoa N/0/X2DMpJERRuOZUxCLUMnacP5Rk1Q0aMZLR9nlqXD7I5d/L1HQZlmGY8Q4iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1674759270; 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=KOLYbqN8AAzXrJw41jLPvEj7d4G3jczP3YZrQZjqBu0=; b=OqLZg4/MBzD5N0QQlFnKuAGQ9IkrC093ZLtGwI21IprY+R1KC4k5bg9R6qzlX3j2trmmat hVVpYUvAvA73Ooze5PcKurSjvCJEKEWbJM2BeP342n8xiLNU+IbSdp2kABIXbYa2vRogTx xiEHu4ESk8axT4WmoA/SLKm9oznIMJ8SWwvUfatP5xDC2fOz4sOyvQtyJaSKAJdMypQoUR 5Odvj9RDTLAVKRgiORgncwaArS2pv2Gs6jvH2qOHxw9zYSkwE+nEWBjbakOIbqSpLfuHxG hYeRyGdJiPZMt1MpRHttW2oMTobSCdNzjOCxiA7T8KLPBAhOE7Vi4NgT+UZRqQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1674759270; a=rsa-sha256; cv=none; b=oIM65g5K8m5Xk8VMSp1VpkS+P2GtGIbCqx5ksUY4MyI/HVFyMRmkEZjqiPKZRJGFlZUG1H hbhuQuOp/SUBKOqRmlC9iw+RfIPA2di3kZw+/k81jpIaTqmZymefoDjOlgUm5b1nsS1VQy geB/nd4GfGMqghMcd9fKvOytFgrLMCVnBY0JuGuQr1/+1VP+mV24FoJL8OGAQKTs35T2Xl At2iKqmYSSVUm0vGMKXKM3fDUjn2Zp6vbR7IK2+djKoNohCsa0WjjFlExMO6Y6/vi0I8sF BoE3KDjUDCIrObAu1x2m6lqg1+E66keSlXWa8B1NJ/ZtdkYZE4/8tgPvRkpg2Q== 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 4P2qd16WmDzg6C; Thu, 26 Jan 2023 18:54:29 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 30QIsTau034293; Thu, 26 Jan 2023 18:54:29 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 30QIsTOk034292; Thu, 26 Jan 2023 18:54:29 GMT (envelope-from git) Date: Thu, 26 Jan 2023 18:54:29 GMT Message-Id: <202301261854.30QIsTOk034292@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: John Baldwin Subject: git: 4b905478ffe4 - stable/13 - bhyve/snapshot: limit snapshot filename to NAME_MAX List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/stable/13 X-Git-Reftype: branch X-Git-Commit: 4b905478ffe43aaedf204064bd52554cbbecaa2e Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=4b905478ffe43aaedf204064bd52554cbbecaa2e commit 4b905478ffe43aaedf204064bd52554cbbecaa2e Author: Robert Wing AuthorDate: 2022-03-18 05:51:31 +0000 Commit: John Baldwin CommitDate: 2023-01-26 18:48:54 +0000 bhyve/snapshot: limit snapshot filename to NAME_MAX NAME_MAX is a better fit since strcat_extension() constructs the filename of the snapshot file. Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D34291 (cherry picked from commit 961e6a12efdbd48d92516beaf0772ff50008457d) --- usr.sbin/bhyve/snapshot.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/usr.sbin/bhyve/snapshot.c b/usr.sbin/bhyve/snapshot.c index 4bd2ea273171..a5217eaab1ec 100644 --- a/usr.sbin/bhyve/snapshot.c +++ b/usr.sbin/bhyve/snapshot.c @@ -181,10 +181,10 @@ strcat_extension(const char *base_str, const char *ext) char *res; size_t base_len, ext_len; - base_len = strnlen(base_str, MAX_VMNAME); - ext_len = strnlen(ext, MAX_VMNAME); + base_len = strnlen(base_str, NAME_MAX); + ext_len = strnlen(ext, NAME_MAX); - if (base_len + ext_len > MAX_VMNAME) { + if (base_len + ext_len > NAME_MAX) { fprintf(stderr, "Filename exceeds maximum length.\n"); return (NULL); }