Bug in 4.2 tip

Sid Stuart sid at linus.UUCP
Sat Jun 30 22:58:51 AEST 1984


Index: 4.2 BSD tip acu.c

Description: I ran into this about a month ago right before I went
on vacation. I forget exactly what was wrong, but I think if you set
the cm variable in /etc/remote to a non-null string, it would cause
tip to dump core and die. The cm string is supposed
to be sent to the computer you are connecting to. Unfortunatly, the
write statement uses the wrong character buffer, it is obvious that
the code is incorrect, if you look at it. The statement is

	pwrite(FD, cp, size(CM);

The problem is that cp and &CM point to different buffers. So if
cp points to a null buffer and &CM points to a buffer with a string in
it... you dump your core. The fix is simple, just put &CM in place of
cp. This fix will have the side effect that the program may do
what it is supposed to at this point.

Repeat: Like I said before, I have forgotten.

Fix:

*** acu.c.orig	Sun May 20 20:13:26 1984
--- acu.c	Sun May 20 20:28:17 1984
***************
*** 34,41
  	int tried = 0;
  
  	if (!DU) {		/* regular connect message */
! 		if (CM != NOSTR)
! 			pwrite(FD, cp, size(CM));
  		return (NOSTR);
  	}
  	/*

--- 34,41 -----
  	int tried = 0;
  
  	if (!DU) {		/* regular connect message */
! 		if (CM != NOSTR) 
! 			pwrite(FD, &CM, size(CM));
  		return (NOSTR);
  	}
  	/*



More information about the Comp.unix.wizards mailing list