🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.utils.bug
Article #634

Indent 1.6: bug in reading stdin

#634
From: Raymond L. Toy
Date: Wed, 26 Aug 1992 08:31
28 lines
1238 bytes
In indent 1.6, there is a stupid bug that causes the
input to be overwritten.  It's caused by not resetting the
input pointer when the buffer has been realloc'ed to a new
place.  The patch is a simple two-line addition to update
the input pointer after realloc'ing the input buffer.
Patch follows.

Ray
----------
Ray -----> toy@soho.crd.ge.com
Toy -----> KWC407, x6270

---------------Cut here------------
*** io.c~       Fri Aug 14 19:09:17 1992
--- io.c        Wed Aug 26 12:26:00 1992
***************
*** 502,509 ****
--- 502,511 ----

        if (ch != EOF)
        {
+         int offset = p - stdinptr.data;
          size += (2 * BUFSIZ);
          stdinptr.data = xrealloc (stdinptr.data, size);
+         p = stdinptr.data + offset;
        }
      }
    while (ch != EOF);
Technical Details
Message-ID: <9208261631.AA14406@alydar.crd.Ge.Com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!alydar.CRd.ge.COM!toy

Show Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!alydar.CRd.ge.COM!toy
From: toy@alydar.CRd.ge.COM (Raymond L. Toy)
Subject: Indent 1.6:  bug in reading stdin
Message-ID: <9208261631.AA14406@alydar.crd.Ge.Com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 26 Aug 1992 08:31:17 GMT
Approved: bug-gnu-utils@prep.ai.mit.edu
Lines: 29