From nobody Sat Jan 11 05:33:38 2025 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 4YVRyW14wRz5lHqf; Sat, 11 Jan 2025 05:33:39 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4YVRyV5WLlz4hhQ; Sat, 11 Jan 2025 05:33:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736573618; 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=uNQw+Z2P1dJJklzr9cqqHiNQpiuBRjZi6fGLvEPORis=; b=dmnRUatFAwC6vY2F8wpBnijHvvIC9b94Qjx8edQxLvUMZB7PGIMqDvUt1di65rzh1UDgAy ySPmo+lJowD2JVSfu+hDNLkUlD/+2ZDratD9QlClI8yvXHkfoRN2uElAsSeeTXBZMIFV8X rbvDkLHXcWnGxLhriO/KRhBn60kWvJyjZCy69vNMDOk5UN+6a0PJIMlCS62qP/9+rjVPXl i66thMU5vbhwu4s3Xkfqea5SBlQbFFjgM77WDh3zr6acUxiVKvv+lL/vrmnzpLHDdiQf9K 5OI9ZHyW3pzLG4AuiJMI8TzXtA4z5ZtlTQj/ix4QcBM8l8xLkMpFoXLeXPtlJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736573618; 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=uNQw+Z2P1dJJklzr9cqqHiNQpiuBRjZi6fGLvEPORis=; b=Y0ikGfHv4L2IjucvfILnBeTl+stVO/WzqzQvF6Xl63foUytk/esSEUBnGUxJLMqTFL+5TL qn5tFYuUeCSfLZeJRG7XUmhz/sdSfqTR/wgkQRsl+gelk8Ix/gs1qvoUquokcJnLc7UMJx /5Nr6gbgqVX23PZYWqbgukNBsMesYEfu736BMZSlNnW/Mi5AKQQYFR2+IfsJfC96mpF8Ck JQd3Bwe0xaAUW9U2NWrfIPR/gTw0765YKl4nlHTUgNmJuW4m3LGlrORFqSWOd7hl/Q9VLX txClEfDW/XHJBUNTg8KFq7OY1o6t+1KNDJTd+PJhAXt2pupZ+bb+THsIsBfm4A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736573618; a=rsa-sha256; cv=none; b=k6NJt/wwEa/C233Vdwdg5Yw4ers+n86/Dn4fCgVXiF5TilvljVmCmuKD+cN1TkIVXc1bIY 32QbSq+e+0VPA3lvhZyvHDmaF2FxABfrIs/K4k0WuahFNodGOzldDI8RPh7Ec0tZNyIgNJ KYm7/ERZnWcaJLL4I4d+dGo4CE/vgfJXMTpqEjfal8PtKgIiw2yI2NqdISgIWY48dUYmUB /igguzSwKsp2VEjhXuEDHyL6RIBgaqqK8KE6u321q1AIMFNdo7jYJyHAWqSx5GpP0Gl6Pn qYAOrB/qx5wNXZhUb+an3ZTq+VSFv4q147uUhXBUI1eyNTsSxdMUo1I0WYotdA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4YVRyV51chzlg8; Sat, 11 Jan 2025 05:33:38 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 50B5XcFD086490; Sat, 11 Jan 2025 05:33:38 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 50B5Xcbx086487; Sat, 11 Jan 2025 05:33:38 GMT (envelope-from git) Date: Sat, 11 Jan 2025 05:33:38 GMT Message-Id: <202501110533.50B5Xcbx086487@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 3999a860d6e8 - main - libbsnmptools: avoid uninitialized snmptoolctx->passwd with empty password 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3999a860d6e899de98b1025317d2d0ef1f83255f Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=3999a860d6e899de98b1025317d2d0ef1f83255f commit 3999a860d6e899de98b1025317d2d0ef1f83255f Author: Gleb Smirnoff AuthorDate: 2025-01-11 05:08:02 +0000 Commit: Gleb Smirnoff CommitDate: 2025-01-11 05:08:02 +0000 libbsnmptools: avoid uninitialized snmptoolctx->passwd with empty password The removed check left snmptoolctx->passwd pointer to uninitialized memory. Always calling strlcpy(3) would guarantee that with empty password it will point to empty string. Submitted by: markj PR: 283909 --- usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c index a9d44cee4364..fb09e1ac785e 100644 --- a/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c +++ b/usr.sbin/bsnmpd/tools/libbsnmptools/bsnmptools.c @@ -178,8 +178,7 @@ snmptool_init(struct snmp_toolinfo *snmptoolctx) warn("malloc() failed"); return (-1); } - if (slen > 0) - strlcpy(snmptoolctx->passwd, str, slen + 1); + strlcpy(snmptoolctx->passwd, str, slen + 1); } return (0);