[comp.sources.bugs] Bug in 1.4 Nethack

tytso@thor.UUCP (08/17/87)

When you ask for help for the 'O'ptions, nethack 1.4 coredumps!  The
problem is that with the addition of the DOGNAME, the length of one of
the help "screens" exceeds BUFSZ, which is defined to 256.  Fix is to
change BUFSZ to BUFSIZ, which is (on a vax BSD4.3) defined to 1024.
WARNING!  I'm not certain on the portability of this patch, as I'm not
an expert on what BUFSIZ is defined to on other machines.  In any case,
you could just hard code it.  (boo, hiss)  char toplines[BUFSIZ] only
needs to be about 300 chars, anyway.

Another change needs to be made to hack.c because the BSD 4.3 cc barfs
since it can't to fit a function in a register :-)  Context diffs follow
for both patches. 

Finally, I'd like to make a plea for context diffs!  It makes it a *lot*
easier to install patches, since with ed diffs, there's so little
redundant information I wasn't sure whether I had installed the patch
correctly or not.  The fact that I had to have to original sources wasn't
*that* painful, since it was under RCS, but still...  At the very least,
a posting of the sum(1) of the patched files would be a nice confidence
check.

----------Feed me to patch
*** /tmp/,RCSt1019359	Mon Aug 17 03:20:47 1987
--- topl.c	Mon Aug 17 03:09:57 1987
***************
*** 11,17 ****
  extern char *eos();
  extern int CO;
  
! char toplines[BUFSZ];
  xchar tlx, tly;			/* set by pline; used by addtopl */
  
  struct topl {
--- 11,17 ----
  extern char *eos();
  extern int CO;
  
! char toplines[BUFSIZ];
  xchar tlx, tly;			/* set by pline; used by addtopl */
  
  struct topl {
-----------------
*** /tmp/,RCSt1019743	Mon Aug 17 03:23:08 1987
--- hack.c	Mon Aug 17 01:20:59 1987
***************
*** 86,92 ****
  	register xchar rx, ry;
  	register struct obj *otmp;
  	register struct trap *ttmp;
! 	register struct	monst *mtmp, *m_at();
  
  	while(otmp = sobj_at(ENORMOUS_ROCK, u.ux+u.dx, u.uy+u.dy)) {
  		rx = u.ux+2*u.dx;
--- 86,93 ----
  	register xchar rx, ry;
  	register struct obj *otmp;
  	register struct trap *ttmp;
! 	register struct	monst *mtmp;
! 	struct monst *m_at();
  
  	while(otmp = sobj_at(ENORMOUS_ROCK, u.ux+u.dx, u.uy+u.dy)) {
  		rx = u.ux+2*u.dx;
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Theodore Ts'o				mit-eddie!mit-athena!tytso
3 Ames St., Cambridge, MA 02139		tytso@athena.mit.edu
			If it's for real, it isn't!