[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Small memory handling error in es-0.9-beta1.tar.gz



I have no idea if anyone besides me still runs es (or anyone cares to
maintain their copies), but here is a patch to the last public release
(that I know of).  It bites you when you configure --with-readline and
then proceed to enter a really long command line under the built
shell.  To ensure that you don't accidentally reverse patch it to a
source tree where it was already done: It is strictly not legal to
call the sequence: ``efree(X); X = erealloc(X, Y);''.

I always love it when you can fix a bug by removing code. ;-)

[Note to BSD ports maintainer: The port lives in /usr/ports/shells/es
 and this patch has been tested as /usr/ports/shells/es/files/patch-ab .
 Also (responding to the comment in revision 1.9 of the port's
 Makefile), as a non-committer and only if it helps, I would be happy
 to be listed in the Makefile as MAINTAINER= ljrittle@acm.org .]

*** input.c.orig	Tue Aug 12 18:59:26 1997
--- input.c	Thu Dec  7 18:35:01 2000
***************
*** 307,313 ****
  			if (in->buflen < nread) {
  				while (in->buflen < nread)
  					in->buflen *= 2;
- 				efree(in->bufbegin);
  				in->bufbegin = erealloc(in->bufbegin, in->buflen);
  			}
  			memcpy(in->bufbegin, rlinebuf, nread - 1);
--- 307,312 ----