From owner-freebsd-bugs Mon Aug 12 10:30:20 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5136637B400 for ; Mon, 12 Aug 2002 10:30:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0C71C43E6A for ; Mon, 12 Aug 2002 10:30:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g7CHU3JU067859 for ; Mon, 12 Aug 2002 10:30:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g7CHU3W4067858; Mon, 12 Aug 2002 10:30:03 -0700 (PDT) Date: Mon, 12 Aug 2002 10:30:03 -0700 (PDT) Message-Id: <200208121730.g7CHU3W4067858@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Ruslan Ermilov Subject: Re: bin/30778: libncurses/termcap.c does not handle escaped colons Reply-To: Ruslan Ermilov Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/30778; it has been noted by GNATS. From: Ruslan Ermilov To: Peter Wemm Cc: bug-followup@FreeBSD.org Subject: Re: bin/30778: libncurses/termcap.c does not handle escaped colons Date: Mon, 12 Aug 2002 20:28:14 +0300 On Mon, Aug 12, 2002 at 10:13:36AM -0700, Ruslan Ermilov wrote: > Old Synopsis: termcap problem with wyse-60 terminal > New Synopsis: libncurses/termcap.c does not handle escaped colons > > Responsible-Changed-From-To: ru->freebsd-bugs > Responsible-Changed-By: ru > Responsible-Changed-When: Mon Aug 12 10:08:19 PDT 2002 > Responsible-Changed-Why: > I know of a better person. > Peter, The FreeBSD replacement for contrib/ncurses/tinfo/read_termcap.c, src/lib/libncurses/termcap.c, is subject to the following bug. The colon (`:') is used to delimit capabilities. To include the colon as part of the value, it must be escaped. (The wy60 entry has this in its "rs" capability, for example.) termcap.c capabilities tokenization code is not aware of escaped colons, causing _nc_termcap to be initialized to a wrong value. The bug is easily demonstrated by this command: env TERMCAP='term:c1=\:\Ev1:c2=v2:' tput -Tterm c1 | hd This appears to fix the bug: %%% Index: termcap.c =================================================================== RCS file: /home/ncvs/src/lib/libncurses/termcap.c,v retrieving revision 1.5 diff -u -p -r1.5 termcap.c --- termcap.c 21 Mar 2002 23:38:38 -0000 1.5 +++ termcap.c 12 Aug 2002 17:22:00 -0000 @@ -200,6 +200,7 @@ _nc_read_termcap_entry(const char *const tcs = pd - 1; for (;;) { while ((tok = strsep(&ps, ":")) != NULL && + *(tok - 2) != '\\' && (*tok == '\0' || *tok == '\\' || !isgraph(*tok))) ; if (tok == NULL) %%% 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-bugs" in the body of the message