Subject: Re: 2nd resend of ftpd bug

From: "Tim P. Starrin" <[email-masked]>
Date: Mon, 21 Oct 1996 12:48:32 -0400

Ok, who maintains wu-ftpd and can post this patch and include it in the 
upcoming release (patch is at the end of this email for wu-ftpd-2.4.2-beta-11).

Tim P. Starrin (CSC)
Project Systems Analyst / Computer Scientist
National Aeronautics and Space Administration
Langley Research Center Operations

Address					Telephone/Email
-------					--------------
Computer Sciences Corporation	 	(804) 864-7373
3217 N. Armistead Ave.			(804) 864-7604 Fax
Hampton, VA 23666			[email-masked]

> From [email-masked] Mon Oct 21 12:35:42 1996
> Date: Mon, 21 Oct 1996 12:14:24 -0400 (EDT)
> From: Alain Magloire <[email-masked]>
> To: [email-masked]
> Cc: [email-masked], [email-masked]
> Subject: Re: 2nd resend of ftpd bug
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> X-Listprocessor-Version: 7.1 -- ListProcessor by CREN
> 
> > 
> > That is the first switch statement, try looking at your source for the same 
> > case in the second switch statement (line 1883 in wuftp-2.4, line 2378 in 
> > wu-ftpd-2.4.2-beta-11).
> > 
> 
> noted, I was assuming, wrongly, that you were refering to function
> send_data()
> 
> > > : > ...
> > > : >  
> > > : >     switch (type) { 
> > > : > ...
> > > : >  
> > > : >     case TYPE_A:
> > > : >         while ((c = getc(instr)) != EOF) {
> > > : >             byte_count++;
> > > : >             if (c == '\n')
> > > : >                 bare_lfs++;
> > > : >             while (c == '\r') {
> > > : >                 if (ferror(outstr))
> > > : >                     goto data_err;
> > > : >                 if ((c = getc(instr)) != '\n') {
> > > : >                     (void) putc('\r', outstr);
> > > : > ------------------> if (c == '\0' || c == EOF)
> > > : >                         goto contin2;
> > > : >                 }
> > > : >             }
> > > : >             (void) putc(c, outstr);
> > > : >           contin2:;
> > > : >         }
> > > : >  
> > > : > ...
> > > 
> > > 
> > 
> > It sounds like the RFC defines no action for NULL bytes, so why is ftpd.c
> > coded to drop them when following ^M's?  By changing this one line in the code,
> > ASCII mode behaves as it does on other systems that don't exhibit the problem.
> > With over 2,000 users having access to our mass storage system, you can imagine
> > the widely-varied levels of computer literacy exhibited by them.   I would just
> > like to close this potential hole that some of them will fall into (despite
> > our efforts to educate them).  Can we call this a bug and have the line 
> > changed to "if (c == EOF)"?
> > 
> 
> :-)
> 
> Maybe you should send your patch to "ftp.academ.." or who ever
> maintain wu-ftpd this days(don't know the email).
> They're suppose to release a beta-1? ... "real soon" :-)
> 
> Can you Cc the patch to the mailing list so I can archive .. and play :)
> 
> > Tim
> > 
> 
> regards, alain
> 

Patch for wu-ftpd-2.4.2-beta-11 src/ftpd.c starts on next line (TPS)...
===================================================================
RCS file: RCS/ftpd.c,v
retrieving revision 1.1
diff -c -r1.1 ftpd.c
*** 1.1 1996/10/21 16:41:23
--- ftpd.c      1996/10/21 16:43:24
***************
*** 2375,2381 ****
                      goto data_err;
                  if ((c = getc(instr)) != '\n') {
                      (void) putc('\r', outstr);
!                     if (c == '\0' || c == EOF)
                          goto contin2;
                  }
              }
--- 2375,2381 ----
                      goto data_err;
                  if ((c = getc(instr)) != '\n') {
                      (void) putc('\r', outstr);
!                     if (c == EOF) /* null byte fix, [email-masked] */
                          goto contin2;
                  }
              }