From nobody Wed Feb 09 17:27:00 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 7DBC019B52A3; Wed, 9 Feb 2022 17:27:01 +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 4Jv6J506WLz3Md3; Wed, 9 Feb 2022 17:27:00 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644427621; 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=8fzmg8xTFxL5MsKOoCg2s//aUuV+W1Xhscwo8dWEeUs=; b=aM/nmntCPmqwQ1pjy2Y3UrX1DpT/7gTjRri/hA99gScXzZuyKjz/baghfLyWGAiVG/cJSg UN4NyJ7HFzkhj7T0AcFts51EHTxYGdUMQNNduulyY+HgqLr4SfeVSD99foJWy2/E3NpnzA tkt5gvpXUgYBwdgBDajUcSo7ssESNVW1nMROET3IaAZluaytuXZ2BoSy6S814/LKyWN3mr 7ouXlIVJC5awKEycwVEtDurtN2AJ7mSZUW3mf3pmxmsHrojhrt8suK3kneXKAF6IFKFdna oaS4jeVOUxJSJs5xnNX6Kdgvw78meQqG5JU1ODF2vQrRzfFaYwTJdlKAzRdzpQ== 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 87A4C11683; Wed, 9 Feb 2022 17:27:00 +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 219HR0uk018877; Wed, 9 Feb 2022 17:27:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 219HR0ps018876; Wed, 9 Feb 2022 17:27:00 GMT (envelope-from git) Date: Wed, 9 Feb 2022 17:27:00 GMT Message-Id: <202202091727.219HR0ps018876@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: 50cf1cf36898 - stable/13 - Fix too small hostname buffer in bootparamd 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: dim X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 50cf1cf36898f8697c32c79e8e7fd279deeee514 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1644427621; 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=8fzmg8xTFxL5MsKOoCg2s//aUuV+W1Xhscwo8dWEeUs=; b=SVdqIqa/ovgwdrYmbbvmbfZ4s2TLduIBbiODauwTYGA7kUl9Cr+wZafeHc3Gxfrxd0zvaW N14K0IBMTL9ZJHci1shYOtMxLtVhgkF9Wuq+n+OGEyaq6qqtkQnvsGa1pRxSGUu1+m8M3t wi1Q7qLSaXAPXKHfdg3D72XL4uxk9xHN/lsGCu24KqRchJhBcIOkLwHkEWeGHnWkh3Nln7 ScbRt0kCUYeGQvaAWiAemI7nUoq4SqpmdW+dPartHH1K9s/zSENO62JEdV6m2Z3gbAtd6u DogNOJiS/ZqYd+1nUjdGn+YoRRTBWpapHqwo9Uz7klySO/fK7D+nWC9+H4NcLw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1644427621; a=rsa-sha256; cv=none; b=vOerWkvnz7LNIeTqb6nirW2SDffSJSOU8T4VPzQ4BocpU80hlTxMRHOjR1DffoMgfc4TTr W+KDf4gMLPYZLZzHPgDwPgwvHxPFa9bXAAlPs+RyltuYnv4Ru7oUuaFmioJMioWkQu+FfB gCKMOvH+/6a9aiSYtzwTcKl12vkN51KvrI1r5hg4RhDxVZ6lXgj2uFFxm3QB51Xm6T5hyY 5aeWZ3C0dVPzGL7nOcbeA8WyiAUwv8rutgBeN9ChND6b8ftQMWciiEeO4lCppbTEZ0gcFO SBi2N3KJDAIS4GHq9XU4/x9Z0G6WepKXTYx5cEsmz6xs5gr8bYQ3F6xsWMwCpQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=50cf1cf36898f8697c32c79e8e7fd279deeee514 commit 50cf1cf36898f8697c32c79e8e7fd279deeee514 Author: Dimitry Andric AuthorDate: 2022-02-06 14:25:22 +0000 Commit: Dimitry Andric CommitDate: 2022-02-09 17:26:18 +0000 Fix too small hostname buffer in bootparamd This fixes the following warning from clang 14: usr.sbin/bootparamd/bootparamd/bootparamd.c:204:32: error: 'fscanf' may overflow; destination buffer in argument 3 has size 255, but the corresponding specifier may require size 256 [-Werror,-Wfortify-source] The MAX_MACHINE_NAME macro indicates the maximum number of bytes in a machine name, but it does not include the NUL terminator required for scanf. MFC after: 3 days (cherry picked from commit d310bf3867b4168e57365196c3a31797c0538097) --- usr.sbin/bootparamd/bootparamd/bootparamd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bootparamd/bootparamd/bootparamd.c b/usr.sbin/bootparamd/bootparamd/bootparamd.c index be885de62f55..5bbd5b4becef 100644 --- a/usr.sbin/bootparamd/bootparamd/bootparamd.c +++ b/usr.sbin/bootparamd/bootparamd/bootparamd.c @@ -34,7 +34,7 @@ extern const char *bootpfile; static struct hostent *he; static char buffer[MAXLEN]; -static char hostname[MAX_MACHINE_NAME]; +static char hostname[MAX_MACHINE_NAME + 1]; static char askname[MAX_MACHINE_NAME]; static char path[MAX_PATH_LEN]; static char domain_name[MAX_MACHINE_NAME];