Date: Mon, 12 Aug 2002 10:30:03 -0700 (PDT) From: Ruslan Ermilov <ru@FreeBSD.org> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/30778: libncurses/termcap.c does not handle escaped colons Message-ID: <200208121730.g7CHU3W4067858@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/30778; it has been noted by GNATS.
From: Ruslan Ermilov <ru@FreeBSD.org>
To: Peter Wemm <peter@FreeBSD.org>
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200208121730.g7CHU3W4067858>
