From nobody Mon Jun 26 17:20:10 2023 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 4QqZNW0X0bz4kTT4 for ; Mon, 26 Jun 2023 17:20:11 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QqZNV3ZnGz3L1T for ; Mon, 26 Jun 2023 17:20:10 +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=1687800010; 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=Vkqv0E4jCkeViSb5CfUb4Qtqu2OmngjxRQa3h4ajv48=; b=vpOzKZNpqVa69Kj4BNVn4Wm8DbWnWxjfP8gknIb1aCE6YaMfrGikOcHwX9UjcLND49fTyF oMB04jQR5ag6l9g6deqCGXSVn0NlLJWDp3npJI8m+H/Mc3lyPj03cW0XLPf79gUAhQgG31 AOO2PqhzEtA7jZa2Lkkej7vsRq8sIbvtVKDr7tqAxbyLhSgkBIJ4WyAwVxE6961pTWyvYF AVSQzpQ4FRGA3ws7h4l8Ik1gRqV7L2d4s4DYdsvZOlklnsHswaicejlkBLvQdAUJ3iVnCE +lfpBzl1RpDlrcVJvvoeyUr/jQsuamy0pkFtU84dbSdCwWXPsXElyxEbTLwS7w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1687800010; a=rsa-sha256; cv=none; b=XtLgwD57mjiFeNg/BL92cRHpFFGraovtS8xWwspC1h6PQ9FJoksgplcUrThUyvWJ+B7EqH zJxoZ+PC1WJmTPFufuEBfa6HEk+6sX3aMTYjo95rwT9qH1PCjQ8j6Aq+aHuZH5nYmG5tDC ceTCqEpQZ6dmSYpHXtT5SOzcYp8oYLZzleanfpGODJsBikZf3FyDIUsBftWPxhHMse1Xrl bn1v38l0FsinOtQJBoj6iF17oxEN9x5EDKzlMidVvcxZ43QaIAaHsivrCVyLqhNrdNRSL1 L9cMld33E8kO9jZvcRH/Nwca6YbujDvcEvej21Ob8dyTXF/HdBoq4g8bt/dVxg== 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 4QqZNV2b7mzJbt for ; Mon, 26 Jun 2023 17:20:10 +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 35QHKAhO084379 for ; Mon, 26 Jun 2023 17:20:10 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 35QHKAAT084378 for bugs@FreeBSD.org; Mon, 26 Jun 2023 17:20:10 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 272226] libpam's openpam_set_option() omits decrement of cur->optc, can lead to NULL dereference Date: Mon, 26 Jun 2023 17:20:10 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D272226 Bug ID: 272226 Summary: libpam's openpam_set_option() omits decrement of cur->optc, can lead to NULL dereference Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu The code in libpam's openpam_set_option() that removes an option: if (value =3D=3D NULL) { /* remove */ if (i =3D=3D cur->optc) RETURNC(PAM_SUCCESS); for (free(cur->optv[i]); i < cur->optc; ++i) cur->optv[i] =3D cur->optv[i + 1]; cur->optv[i] =3D NULL; RETURNC(PAM_SUCCESS); } It's missing a final "cur->optc -=3D 1", which can cause a subsequent openpam_get_option() to crash when it runs off the end of cur->optv[] and passes the terminal NULL to strncmp(). --=20 You are receiving this mail because: You are the assignee for the bug.=