[comp.bugs.4bsd] rexec/rexecd bug + fix

news@rtech.UUCP (USENET News System) (05/06/88)

Description:
	rexec(3) incorrectly uses a short to hold a u_short port number.
	When the machine has been running long enough, this causes a 
	wraparound error, and connection attempts fail.


*** rexecd.c	Fri Apr 29 10:43:47 1988
--- rexecd.c.new	Fri Apr 29 10:48:01 1988
***************
*** 76,78
  	int s;
! 	short port;
  	int pv[2], pid, ready, readfrom, cc;
 
--- 76,78 -----
  	int s;
! 	u_short port;
  	int pv[2], pid, ready, readfrom, cc;
 
*** rexec.c	Fri Apr 29 10:43:28 1988
--- rexec.c.new	Fri Apr 29 10:47:16 1988
***************
*** 33,35
  	char c;
! 	short port;
  	struct hostent *hp;
 
--- 33,35 -----
  	char c;
! 	u_short port;
  	struct hostent *hp;
***************
*** 83,85
  		port = ntohs((u_short)sin2.sin_port);
! 		(void) sprintf(num, "%d", port);
  		(void) write(s, num, strlen(num)+1);
 
--- 83,85 -----
  		port = ntohs((u_short)sin2.sin_port);
! 		(void) sprintf(num, "%u", port);
  		(void) write(s, num, strlen(num)+1);
 
 
 
From: daveb@llama.rtech.UUCP ("It takes a clear mind to make it")
Path: llama!daveb




{amdahl, cpsc6a, mtxinu, ptsfa, sun, hoptoad}!rtech!daveb daveb@rtech.uucp