From owner-freebsd-audit Fri Feb 8 3:59:42 2002 Delivered-To: freebsd-audit@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id AE20737B419 for ; Fri, 8 Feb 2002 03:59:33 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g18BxBW63101; Fri, 8 Feb 2002 13:59:11 +0200 (EET) (envelope-from ru) Date: Fri, 8 Feb 2002 13:59:11 +0200 From: Ruslan Ermilov To: biometrix Cc: audit@FreeBSD.ORG Subject: Re: GNU rcs suite - RCSLOCALID overflow. Message-ID: <20020208135911.B54593@sunbay.com> References: <20020206230233.DUPK10804.out006.verizon.net@there> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20020206230233.DUPK10804.out006.verizon.net@there> User-Agent: Mutt/1.3.23i Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Tue, Feb 05, 2002 at 05:06:15PM +0000, biometrix wrote: > There is a buffer overflow in the GNU RCS suite. > It occurs in the handling of the RCSLOCALID environment variable. > > in /usr/src/gnu/usr.bin/rcs/lib/rcskeys.c the function setRCSLocalId() the > variable ("string") is set from the earlier call cgetenv("RCSLOCALID"))) > If RCSLOCALID string is to large for the buffer that is about to be strcpy'd > into local_id a warning is given in the form of : > error("LocalId is too long"); > The error is not trapped and so a segmentation fault occurs at this line: > VOID strcpy(local_id, key); > > I truncated the RCSLOCALID variable to the size of "keylength" with a > strlcpy() call. This probably wasn't the best way of handling it? but it does > seem to handle the error Ok. > > example: > bash-2.05# export RCSLOCALID=`perl -e 'print "A" x 5000'` > bash-2.05# rcs > rcs: LocalId is too long > Segmentation fault (core dumped) > bash-2.05# /usr/src/gnu/usr.bin/rcs/rcs/rcs > rcs: LocalId is too long. truncated RCSLOCALID > bash-2.05# > Thanks for the spot! I've committed a different fix. Cheers, -- Ruslan Ermilov Sysadmin and DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message