From nobody Sat Jun 03 14:34:12 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 4QYMnc6YRWz4YtTc for ; Sat, 3 Jun 2023 14:34:12 +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 4QYMnc4hsZz4CVG for ; Sat, 3 Jun 2023 14:34:12 +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=1685802852; 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=LrUnyP9tz14r1Nj8SPv0SjTDH149dTjAExKsS+OneTE=; b=F26DbCs9nqVfZvMjDHBaNnQebiWZQHyCdFo/+U6nOFKoe8uSPm1kl/DGpENRlKNQv21mkY Pm6cllRRrfAthIZN5UDPUm0946wSzxFEh0KX1ATaupeqizIGfEjlTLF4lO0ogQk8KROIPa 1l0Ox6/No7aLmD42pz9pETOXxkvBYCXKLVJGHzG3ZdxX9Vv0upGiw507l3I9L3nRIJyccG g8jTtHLbUezk1ip8fqNlupP7/t84OmgIFvHWi7A1e7BYxn36QJblNSuS/ang8TItcqEM+t 1bJzh4JyEZgM3OJPLrupf2XM1FK4VpVV/ne6rjXOx/qDlbT9TfylbstBjW0kaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1685802852; a=rsa-sha256; cv=none; b=A2a9XyuSm91c2nm1YoeUtIws0gCRoxtALkMxtYxW/kutJ/4vwBTEx5WiqZnRyLd7WCuFhs PqJUuJQwdFPBHszIDsqhrzhnVUMGqOZk6woS6znbMzUIoWoEJj44wZ6zGJB0oTpFxQS5fG w9sXDTQH2ox1oM/HfbUIqtHcCptZG5Eq6By9leOZ3xztZtm8PpVQXjiNpbjnIMlf3+boe4 001m9OTTBFVxRN4XTLHe1HUB6AaK/KGiR87hWr5Uuiqos7is9ZvJ9aacUX9LtwAtMthMdC MxKI3qq6futwoHOT20/rnW04rFYTgFM+9PdigcapLXIVdSQ7mrnKBJZ+G3I5YA== 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 4QYMnc3n0ZzSgq for ; Sat, 3 Jun 2023 14:34:12 +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 353EYCdp013727 for ; Sat, 3 Jun 2023 14:34:12 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 353EYCjc013726 for bugs@FreeBSD.org; Sat, 3 Jun 2023 14:34:12 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 271805] off-by-one error in protoname() in ppp's lcp.c -> bad pointer dereference Date: Sat, 03 Jun 2023 14:34:12 +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 attachments.mimetype attachments.created 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=3D271805 Bug ID: 271805 Summary: off-by-one error in protoname() in ppp's lcp.c -> bad pointer 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 Attachment #242575 text/plain mime type: Created attachment 242575 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D242575&action= =3Dedit crash ppp by tripping over an off-by-one error in protoname() In /usr/src/usr.sbin/ppp/lcp.c, in protoname(): if (proto > sizeof cftypes / sizeof *cftypes || cftypes[proto] =3D=3D NUL= L) return HexStr(proto, NULL, 0); I think it should be >=3D rather than >. I've attached a demo program, which produces a crash with this backtrace: #0 strlen () at /usr/src/lib/libc/amd64/string/strlen.S:47 #1 0x000022d936d7ba23 in __vfprintf (fp=3D0x22d931e9c888, locale=3D0x22d93= 6e3b278 <__xlocale_global_locale>, fmt0=3D0x22d111d89c2f " %s[%d]", ap=3D0x22d931e9= c9c0) at /usr/src/lib/libc/stdio/vfprintf.c:854 #2 0x000022d936d78ab0 in snprintf (str=3D0x22d931e9cae0 "\035", n=3D19, fmt=3D0x22d111d89c2f " %s[%d]") at /usr/src/lib/libc/stdio/snprintf.c:74 #3 0x000022d111dc24da in LcpDecodeConfig (fp=3D0x22d93917b7e8, cp=3D0x22d9= 3919f237 '\245' ...,=20 end=3D0x22d93919f16c "\377\377\377\377\377\377\377\377\263=C3=84=C2=A5"= , '\245' , mode_type=3D0, dec=3D0x22d931e9cd50) at /usr/src/usr.sbin/ppp/lcp.c:683 #4 0x000022d111db68f6 in FsmRecvConfigReq (fp=3D0x22d93917b7e8, lhp=3D0x22d931e9cee8, bp=3D0x22d93919f100) at /usr/src/usr.sbin/ppp/fsm.c:4= 96 #5 0x000022d111db5fd0 in fsm_Input (fp=3Dfp@entry=3D0x22d93917b7e8, bp=3Dbp@entry=3D0x22d93919f100) at /usr/src/usr.sbin/ppp/fsm.c:1096 #6 0x000022d111dc1d0c in lcp_Input (bundle=3D, l=3D, bp=3D0x22d93919f100) at /usr/src/usr.sbin/ppp/lcp.c:1305 #7 0x000022d111dc416c in Despatch (bundle=3D0x22d111dea4b0 , l=3D0x22d93917b600, bp=3D0x22d93919f100, proto=3D) at /usr/src/usr.sbin/ppp/link.c:381 #8 link_PullPacket (l=3D0x22d93917b600, buf=3D, len=3D, b=3D0x22d111dea4b0 ) at /usr/src/usr.sbin/ppp/link.c:323 #9 0x000022d111d9de25 in bundle_DescriptorRead (d=3D, bundle=3D0x22d111dea4b0 , fdset=3D0x22d9391a6140) at /usr/src/usr.sbin/ppp/bundle.c:546 #10 0x000022d111dc7704 in DoLoop (bundle=3D0x22d111dea4b0 ) at /usr/src/usr.sbin/ppp/main.c:661 #11 main (argc=3D3, argv=3D) at /usr/src/usr.sbin/ppp/main.c= :535 --=20 You are receiving this mail because: You are the assignee for the bug.=