Subject: Re: 1.5 ftp proxy (pr #11133)
To: Dan J Fraser <dfraser@capybara.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 02/11/2001 17:06:51
--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii

On Thu, Feb 08, 2001 at 01:18:53PM -0500, Dan J Fraser wrote:
> This thing is affecting me too....
> 
> A user on my lan hits ftp://ftp.kernel.org from his netscape, and my server
> locks up.  Can I provide any info to this PR for anyone?
> 
> I can reproduce this bug.
> 
> I'm not subscribed to tech-kern, so email me. :)

I'm using the attached patch. It's extracted from the ipf 3.4.12 distribution.
I'm not sure it's completely rigth (changes to other files may be missing)
but it prevents my router from hanging. I'm not waiting fot 3.4.16 to be
imported :)

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--

--C7zPtVaVf+AK4Oqc
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=diff

Index: ip_ftp_pxy.c
===================================================================
RCS file: /cvsroot/syssrc/sys/netinet/ip_ftp_pxy.c,v
retrieving revision 1.16.4.1
diff -u -r1.16.4.1 ip_ftp_pxy.c
--- ip_ftp_pxy.c	2000/08/31 14:49:49	1.16.4.1
+++ ip_ftp_pxy.c	2001/02/11 16:03:58
@@ -672,15 +672,18 @@
 			while ((rptr < wptr) && (*rptr != '\r'))
 				rptr++;
 
-			if ((*rptr == '\r') && (rptr + 1 < wptr)) {
-				if (*(rptr + 1) == '\n') {
-					rptr += 2;
-					f->ftps_junk = 0;
+			if (*rptr == '\r') {
+				if (rptr + 1 < wptr) {
+					if (*(rptr + 1) == '\n') {
+						rptr += 2;
+						f->ftps_junk = 0;
+					} else
+						rptr++;
 				} else
-					rptr++;
+					break;
 			}
-			f->ftps_rptr = rptr;
 		}
+		f->ftps_rptr = rptr;
 
 		if (rptr == wptr) {
 			rptr = wptr = f->ftps_buf;

--C7zPtVaVf+AK4Oqc--