httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <hart...@ooo.lanl.gov>
Subject Re: WWW Form Bug Report: "getline() function in util.c is (fwd)
Date Tue, 21 May 1996 13:13:56 GMT

> Message-Id: <2.2.32.19960521181940.007595d8@mail.in.icorp.net>
> X-Sender: mdperry@mail.in.icorp.net
> X-Mailer: Windows Eudora Pro Version 2.2 (32)
> Mime-Version: 1.0
> Content-Type: text/plain; charset="us-ascii"
> Date: Tue, 21 May 1996 13:19:40 -0500
> To: hartill@lanl.gov
> From: Mike Perry <mdperry@icorp.net>
> Subject: Re: WWW Form Bug Report: "getline() function in util.c is
>   buggy; if maxlen chars are read, last char is lost." on BSDI2.1 (fwd)
> Status: RO
> 
> At 11:25 AM 5/21/96 MDT, you wrote:
> >
> >> Message-Id: <199605210558.WAA23863@taz.hyperreal.com>
> >> From: mdperry@icorp.net
> >> To: apache-bugs%apache.org@organic.com
> >> Date: Mon May 20 22:58:47 1996
> >> Subject: WWW Form Bug Report: "getline() function in util.c is buggy; 
> >>      if maxlen chars are read, last char is lost." on BSDI2.1
> >> 
> >> Submitter: mdperry@icorp.net
> >> Operating system: BSDI2.1, version: all
> >> 
> >> I have a fix for the getline() procedure - e-mail me and I'll 
> >> drop it to you.  I can't believe you guys didn't catch this sooner.
> >
> >Please send us a patch for consideration.
> 
> Here you go.
> 
int getline(char *s, int n, FILE *f) {
/*
  read line from specified file; returns nz=EOF

  Modified 05/96 by Mike Perry (mdperry@icorp.net) to correct a bug 
  which truncates the last char read if max line size is reached.
*/
  register int i=0;
  n--;  /* you might want to remove n--, depending upon how you id string
length */
  while(i<n) {
    s[i] = (char)fgetc(f);
    if(s[i] == CR)
      s[i] = fgetc(f);
    if((s[i] == 0x4) || (s[i] == LF) ) {
      s[i] = '\0';
      return (feof(f) ? 1 : 0);
    }
    ++i;
  }
  s[n]='\0';
  return (feof(f) ? 1 : 0);
}


>The rumor is that Jack Kevorkian has setup a Windows-NT users group.

Love the tagline!

 - Mike
"Things do come to those who wait, 
  but only things left over from those that hustle."
  - Abraham Lincoln

|--------------------------------------
| InterCommerce Corporation
| http://www.icorp.net
|--------------------------------------
* Advanced client-server systems for the Internet: Shopping, 
   Demographics, Classifieds, etc.
* Web site development by Advertising, Marketing & Graphic Design experts
* Emphasis and results based on your business objectives
* State-of-the-art techology
* Nerd visitation hours: Tue-Thur 11pm-4am

Mime
View raw message