[4659] in Athena Bugs

home help back first fref pref prev next nref lref last post

rt 6.4R: ftpd

daemon@ATHENA.MIT.EDU (Jonathan I. Kamens)
Sun Apr 1 20:20:10 1990

Date: Sun, 1 Apr 90 20:19:58 -0400
From: "Jonathan I. Kamens" <jik@pit-manager.MIT.EDU>
To: bugs@ATHENA.MIT.EDU
System name:		pit-manager
Type and version:	RTPC-ROMPC 6.4R
Display type:		apa16
			megapel

What were you trying to do?
	I was looking at the sources to ftpd in order to fix another
	bug, and stumbled upon this one.

What's wrong:
	The function passive() in ftpd.c makes the following call to
	the reply() function:

	reply(227, "Entering Passive Mode (%d,%d,%d,%d,%d,%d)", UC(a[0]),
		UC(a[1]), UC(a[2]), UC(a[3]), UC(p[0]), UC(p[1]));

	As you can see, it is passing 8 arguments altogether into
	reply().  The problem is that reply() only supports up to 7
	arguments.

What should have happened:
	Reply() should be modified to support one more argument.  Of
	course, what REALLY should happen is that it should use
	varargs, but I don't feel like implementing that right now.
	The patch below fixes this problem.

*** /tmp/,RCSt1002111	Sun Apr  1 20:19:38 1990
--- ftpd.c	Sun Apr  1 20:13:27 1990
***************
*** 632,649 ****
  	dologout(0);
  }
  
! reply(n, s, p0, p1, p2, p3, p4)
  	int n;
  	char *s;
  {
  
  	printf("%d ", n);
! 	printf(s, p0, p1, p2, p3, p4);
  	printf("\r\n");
  	(void) fflush(stdout);
  	if (debug) {
  		syslog(LOG_DEBUG, "<--- %d ", n);
! 		syslog(LOG_DEBUG, s, p0, p1, p2, p3, p4);
  	}
  }
  
--- 632,649 ----
  	dologout(0);
  }
  
! reply(n, s, p0, p1, p2, p3, p4, p5)
  	int n;
  	char *s;
  {
  
  	printf("%d ", n);
! 	printf(s, p0, p1, p2, p3, p4, p5);
  	printf("\r\n");
  	(void) fflush(stdout);
  	if (debug) {
  		syslog(LOG_DEBUG, "<--- %d ", n);
! 		syslog(LOG_DEBUG, s, p0, p1, p2, p3, p4, p5);
  	}
  }
  

home help back first fref pref prev next nref lref last post