rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
From: rjc@math.Princeton.EDU
To: rc@archone.tamu.edu
Subject: Bug in Simmy's readline replacement (with patch)
Date: Mon, 17 Feb 1992 20:12:52 -0600	[thread overview]
Message-ID: <9202180212.AA10506@math.princeton.edu> (raw)

This one took me two days to track down.

edit/editline.c, function insert_string:

Change

    if ((el_end + len) > el_length)

to

    if ((el_end + len + 1) > el_length)

or more efficiently,

    if ((el_end + len) >= el_length)

Simmy forgot to count the trailing 0 that terminates a string.

Without this, we end up storing a 0 past the end of our allocated
block, stomping on the malloc arena, and causing weird crashes in
weird places at unspecified points in the future.

(Sorry, no context diff since I had to hack up other stuff to get rc
to run on my bizarre box that doesn't deserve the name UNIX.)
--
Raymond ``What a ripoff.  I bust my butt day in and day out...''[7f01] Chen
         (Only Brendan will get the quote ref.)



                 reply	other threads:[~1992-02-18  2:13 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9202180212.AA10506@math.princeton.edu \
    --to=rjc@math.princeton.edu \
    --cc=rc@archone.tamu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).