From owner-freebsd-bugs@freebsd.org Wed Aug 26 17:01:51 2020 Return-Path: Delivered-To: freebsd-bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8AE5C3B319C for ; Wed, 26 Aug 2020 17:01:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.nyi.freebsd.org (unknown [127.0.1.3]) by mx1.freebsd.org (Postfix) with ESMTP id 4BcBwb39pkz4JrL for ; Wed, 26 Aug 2020 17:01:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.nyi.freebsd.org (Postfix) id 6D10B3B2B72; Wed, 26 Aug 2020 17:01:51 +0000 (UTC) Delivered-To: bugs@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6CDB23B2B70 for ; Wed, 26 Aug 2020 17:01:51 +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 "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4BcBwb2LkSz4JXb for ; Wed, 26 Aug 2020 17:01:51 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) 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 3553E16685 for ; Wed, 26 Aug 2020 17:01:51 +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 07QH1p8K086415 for ; Wed, 26 Aug 2020 17:01:51 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 07QH1pux086414 for bugs@FreeBSD.org; Wed, 26 Aug 2020 17:01:51 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 248932] integer underflow in grp_unmarshal_func triggered by nscd Date: Wed, 26 Aug 2020 17:01:50 +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: 11.4-RELEASE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: asomers@FreeBSD.org 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.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 MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Aug 2020 17:01:51 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D248932 Bug ID: 248932 Summary: integer underflow in grp_unmarshal_func triggered by nscd Product: Base System Version: 11.4-RELEASE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: bin Assignee: bugs@FreeBSD.org Reporter: asomers@FreeBSD.org Created attachment 217545 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D217545&action= =3Dedit Fix integer underflow in getgrent.c When calling getgrnam_r for nonexistent group "root", nscd will for some re= ason return a 1-byte buffer. This triggers an underflow from an unsigned integer comparison, causing grp_unmarshal_func to return ERANGE. That, in turn, may lead applications to repeat the call with ever-larger buffers. I haven't tried to debug nscd yet, but I think the correct thing to do in t= his case is for grp_unmarshall_func to return NS_UNAVAIL. That's what the atta= ched patch does. Steps to Reproduce: * Install pkg from git head (prior to https://github.com/freebsd/pkg/pull/1= 873 pkg would ignore ERANGE errors) * enable nscd. I'm using it with LDAP, and in my nsswitch.conf I have "gro= up: files cache ldap", but I don't think the order matters. * Try to install a package that sets the group ownership of one or more fil= es to "root" (which does not exist). It will print errors like: pkg: getgrnam_r: Result too large --=20 You are receiving this mail because: You are the assignee for the bug.=