From nobody Fri Mar 18 05:53:28 2022 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 E99B41A2BFAC; Fri, 18 Mar 2022 05:53:28 +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 4KKY8m6Cpdz4gK5; Fri, 18 Mar 2022 05:53:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647582808; 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=93FwAAVxjNDyftIX6/iA/bh8nu7KlzK10QFOzl3Ti7I=; b=TA03UwBdemW0Q++X4vwVYm1awMttpLnXQPVWUVkEBnQl75CA6ID4kImMEaiVPriIr5sFhp oo6eeotUeEZkqPtJdRf5MoFg0sMkuIgi2hH9maNdl0wG/5Ia6Bz407vzlR2FPZhj5ER/vr 9rxm+3YVYwCgFFNV7h9z9HtZyQbx4Yln7lBjD8+zB+Sq315g5B9qOld2ShY62RcTKdBfs1 KLt2geujHLvZRIW4GxoUN0qnnf9lAxgWfhyH4sXvWgIl8NhMQMI0sf9kzNUnNcyKmxAfCT cRiEbaMfYBNtGHfftjzw92oSqDq4nT/VeaDcNHE/vsVFlg58haSIKaSTv5TrRw== 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 B5848196A9; Fri, 18 Mar 2022 05:53:28 +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 22I5rS99097107; Fri, 18 Mar 2022 05:53:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22I5rSq3097106; Fri, 18 Mar 2022 05:53:28 GMT (envelope-from git) Date: Fri, 18 Mar 2022 05:53:28 GMT Message-Id: <202203180553.22I5rSq3097106@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Robert Wing Subject: git: 961e6a12efdb - main - 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: rew X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 961e6a12efdbd48d92516beaf0772ff50008457d Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647582808; 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=93FwAAVxjNDyftIX6/iA/bh8nu7KlzK10QFOzl3Ti7I=; b=tiVSaqn+ybtBrnairr1X2ngax4CDrj88PwDbJaQvQRuKxZiOFqiVCmz7DyKpxE2AtAgYsf A4qx+IXHqeNXqFi244Z/0fsu5LKCsIPTFnErT89CL9nOZ9CfIqkdy8ePjJsPonCItFdW4r pNMI0JK19T9EKc3NcCkQ1AbG/mDNyugOoLy8N9OtTU+TzTrkyTy4EjwlwiuocMge2kDpAi jUAQMJkFqbJY/wzR3AF6oduXO8GsoqyF5AICNphKVskwANf5twl1r4i2qmh/k6yA7DMPeA jvVE/Wbpx5ZcsZIiqssmYMUGYLjQ2mjOEyR2J/f4MSNgoilgZZW8pAopIUNBvw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647582808; a=rsa-sha256; cv=none; b=gLMfepT0FxeGWCiDWvPeilNzcMgH7yywA2CqEVFR13vkyHlXJc7KoRnSRJU+CZXEQSk7xu NkSAwkfDOdjxsrM723oqXwovNfBJbAp5paxPDaX8XSySdizZ1EMLsOOG+VJ8YmndGAh+l8 n/mlfp7FJAff/oJ43I3JPTJFWIRTth4yvhpMSuNVaBgEBbDxnevQkvmKTc2Jq9zzsTtmah 0FLWtLqp2/DlWmFyxQobt8fv0QJwwmVHHeUS4k3R0L7zPWVRl2SgavZG9/l0dnrAD/sgWF D6dwznKxj2MvrNskvXLb/J4VqU1NED6xK90AcrJOSQnHaom1i2MJ+A2qNf5Rig== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by rew: URL: https://cgit.FreeBSD.org/src/commit/?id=961e6a12efdbd48d92516beaf0772ff50008457d commit 961e6a12efdbd48d92516beaf0772ff50008457d Author: Robert Wing AuthorDate: 2022-03-18 05:51:31 +0000 Commit: Robert Wing CommitDate: 2022-03-18 05:51:31 +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 --- 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 13154c68c3e7..585fc2bc6f47 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); }