fix to termcap.c and remcap.c

John Stewart stewart at seismo.UUCP
Sat Dec 10 06:04:53 AEST 1983


This is a repeat of a fix I reported about a year ago, but which
apparently did not make it to "official" versions.
It appears in .../tip/remcap.c (4.6	81/11/29), which is hacked from
.../libtermlib/termcap.c (unnumbered and undated).

The problem is that if the string `tcname' is not terminated with a
colon, the indicated while loop will clobber one somewhere else in
your stack.

Note in passing, that the problem is rarely seen if keepers of
/etc/remote and /etc/termcap are relatively fastidious in adhering
to the proper format.

	John Stewart, Teledyne Geotech

*** remcap.c	Fri Dec  9 14:28:23 1983
--- remcap.c.bad	Thu Jul 28 11:12:08 1983
***************
*** 168,174
  		return(1);
  	strcpy(tcname,p+3);
  	q = tcname;
! 	while (*q && *q != ':')
  		q++;
  	*q = 0;
  	if (++hopcount > MAXHOP) {

--- 168,174 -----
  		return(1);
  	strcpy(tcname,p+3);
  	q = tcname;
! 	while (q && *q != ':')
  		q++;
  	*q = 0;
  	if (++hopcount > MAXHOP) {



More information about the Comp.unix.wizards mailing list