[comp.bugs.4bsd] Another Curses Bug

denise@mcvax.UUCP (03/26/87)

Index:	/usr/src/usr.lib/libcurses/overlay.c 4.3BSD

Description:
	The function overlay actually overwrites.  This is so glaring a bug
	I have a hard time believing that it is not some local oddity that
	we have, but everyone seems to think it is real, unmodified, Berkeley
	code.  On the other hand, Ultra Rogue and Larn are the only things
	I can find that actually use it, the larn distribution includes
	its own overlay.

Repeat-By:
	Play urogue and read a scroll of gold detection.

Fix:
	Apply the following diff:

	*** overlay.c.old	Thu Mar 26 14:01:07 1987
	--- overlay.c		Thu Mar 26 14:34:15 1987
	***************
	*** 6,11 ****
	--- 6,12 ----
	  
	  #ifndef lint
	  static char sccsid[] =  "@(#)overlay.c	5.2 (Berkeley) 2/12/86";
	+ static char sccsid2[] = "@(#)overlay.c	1.2 (CWI Mods) 87/03/26";
	  #endif not lint
	  
	  # include	"curses.ext"
	***************
	*** 37,48 ****
	  # endif
	  	if (starty >= endy || startx >= endx)
	  		return;
	- 	x = endx - startx;
	- 	for (y = starty; y < endy; y++) {
	- 		bcopy(&win1->_y[y - win1->_begy][startx - win1->_begx],
	- 		      &win2->_y[y - win2->_begy][startx - win2->_begx], x);
	- 		touchline(win2, y, startx - win2->_begx, endx - win2->_begx);
	- 	}
	  	y1 = starty - win1->_begy;
	  	y2 = starty - win2->_begy;
	  	for (y = starty; y < endy; y++, y1++, y2++) {
	--- 38,43 ----

denise
denise@cwi.nl