[comp.sources.bugs] Bug in "less"

mark@UNIX386.Convergent.COM (Mark Nudelman) (09/20/88)

There is a rather serious bug in the version of "less" which was recently
posted to comp.sources.unix.  In the file "os.c", line 204 reads:

		cmd = calloc(strlen(p)+12);

This should be changed to:

		cmd = calloc(strlen(p)+strlen(filename)+12, sizeof(char));

This bug was due to a last minute change, and I apologize for any
inconvenience this may have caused.


Mark Nudelman
{sun,decwrl,ihnp4!hplabs}!pyramid!ctnews!mitisft!markn

mark@UNIX386.Convergent.COM (Mark Nudelman) (09/20/88)

[ Sorry if this is a duplicate message; I had some trouble posting
  this the first time. ]

There is a rather serious bug in the version of "less" which was recently
posted to comp.sources.unix.  In the file "os.c", line 204 reads:

		cmd = calloc(strlen(p)+12);

This should be changed to:

		cmd = calloc(strlen(p)+strlen(filename)+12, sizeof(char));

This bug was due to a last minute change, and I apologize for any
inconvenience this may have caused.


Mark Nudelman
{sun,decwrl,ihnp4!hplabs}!pyramid!ctnews!mitisft!markn

viktor@math.princeton.edu (03/09/90)

	Less incorrectly detects EOF when a file of greater than screen
height lines follows a short (<=sc_height lines) file.

	The problem is related to the varaible squished not being cleared
with the conclusion that the next file is also short.

	One fix is to reset squished in prepaint() instead of squish_check(),
since prepaint() is called by squis_check(),  the latter remains
essentially the same,  while we squash the squish bug since prepaint
is called early in the processing of each file.

===================================================================
RCS file: RCS/prim.c,v
retrieving revision 1.1
diff -c -r1.1 prim.c
*** /tmp/,RCSt1a05224	Thu Mar  8 12:58:36 1990
--- prim.c	Thu Mar  8 12:52:54 1990
***************
*** 100,106 ****
  {
  	if (!squished)
  		return;
- 	squished = 0;
  	repaint();
  }
  
--- 100,105 ----
***************
*** 356,361 ****
--- 355,361 ----
  	POSITION pos;
  {
  	hit_eof = 0;
+ 	squished = 0;
  	forw(sc_height-1, pos, 1, 0);
  	screen_trashed = 0;
  }
	Viktor Dukhovni <viktor@math.princeton.edu>	: ARPA
		<...!uunet!princeton!math!viktor>	: UUCP
	Fine Hall, Washington Rd., Princeton, NJ 08544  : US-Post
		+1-(609)-258-5792		 	: VOICE