From nobody Fri Jan 10 20:30:19 2025 X-Original-To: bugs@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 4YVCvc4jkgz5kVhn for ; Fri, 10 Jan 2025 20:30:20 +0000 (UTC) (envelope-from bugzilla-noreply@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 4YVCvc3gcPz4XPp for ; Fri, 10 Jan 2025 20:30:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1736541020; 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: in-reply-to:in-reply-to:references:references; bh=3rzi+0PK3RaWGO5Qkme6jQV76Pkmnmh70y2cMksUfLM=; b=EB2dlQfe3sdNhGuxW4oQUeutyrUgjdDteEnoyi9gx5xQcPdw2Yvp3V+3cUaS9m4JgkCn/a 2a5fsxexf0LGIht8F4Deki8GoP7iL9jZBmuv6PxPpS42J2L6LSyL0xFCkgdzOmXIwk3I1O C6EDisb9WvOdo0zV3xPwlCbEQaP/NOa6SiaFP/gOxrwr+hyc7cvVLyoTWuVymS41HiChXp 1zdFCr707jigmQSf7pewdwzI2RWd+V5j/9Fma1U7pkpeK4hw3F6IzIDWGvxd5a0Kpj0Rbd errn6Zl+w6aZcqjTVnoxjOKxv1YJnHL5L1e5yONdiRII/GtBTK2Gh25V5KLsfw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1736541020; a=rsa-sha256; cv=none; b=OJW5MEbZiLLiK9WomeC8ve8ys/jAvoVkkVYNeLN4fwlzqZjgYmstJ5uQQ2/ahI41B52BJJ rQcbFka4eqdiK206BVJEtiodL4HKYlamk7XT7V7+i1UVnodBU4LKLp1Nf3Sw21Qm0PK86c XmdZ+TZokLsrmwhez8UvJmUpPbsgNqbauZmAf9ADn1PdOk3UJ8mS86X0OVXMbXUV+DznJ0 kLcgQQE5RLnqeg74FweozTfm4UyyiJlsKWS8Qj3Xf4gc4XcMYllwImPVHpCeSseKzuH6Ro jKdOnVcUR/XbO1RmGqMzrHdpFFaytb72q7ZJiFHedwHi5PYorfN9DscJ5JmHog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (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 4YVCvc2jHmzBXc for ; Fri, 10 Jan 2025 20:30:20 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 50AKUKAA056233 for ; Fri, 10 Jan 2025 20:30:20 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 50AKUKWT056232 for bugs@FreeBSD.org; Fri, 10 Jan 2025 20:30:20 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 283909] bsnmpget/walk: coredump when SNMPPASSWD is empty Date: Fri, 10 Jan 2025 20:30:19 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: 13.3-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: markj@FreeBSD.org X-Bugzilla-Status: Open X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D283909 Mark Johnston changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |markj@FreeBSD.org --- Comment #4 from Mark Johnston --- (In reply to Gleb Smirnoff from comment #3) Looks reasonable to me. The code which allocates the buffer also looks wro= ng: 174 if ((str =3D getenv("SNMPPASSWD")) !=3D NULL) {=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 175 if ((slen =3D strlen(str)) > MAXSTR)=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 176 slen =3D MAXSTR - 1;=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 177 if ((snmptoolctx->passwd =3D malloc(slen + 1)) =3D=3D = NULL) {=20=20=20=20 178 warn("malloc() failed");=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 179 return (-1);=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20 180 }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 181 if (slen > 0)=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20 182 strlcpy(snmptoolctx->passwd, str, slen + 1);= =20=20=20=20=20=20=20 183 }=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 Aren't we leaving passwd[0] uninitialized if slen =3D=3D 0? --=20 You are receiving this mail because: You are the assignee for the bug.=