From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21627 invoked from network); 8 May 1998 06:30:10 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 8 May 1998 06:30:10 -0000 Received: (from list@localhost) by math.gatech.edu (8.8.5/8.8.5) id CAA10661; Fri, 8 May 1998 02:26:45 -0400 (EDT) Resent-Date: Fri, 8 May 1998 02:26:45 -0400 (EDT) From: Zoltan Hidvegi Message-Id: <199805080626.BAA02707@hzoli.home> Subject: PATCH: fix read -k coredump To: zsh-workers@math.gatech.edu (Zsh hacking and development) Date: Fri, 8 May 1998 01:25:41 -0500 (CDT) X-Mailer: ELM [version 2.4ME+ PL31 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Resent-Message-ID: <"BGOiy3.0.Wc2.aMgKr"@math> Resent-From: zsh-workers@math.gatech.edu X-Mailing-List: archive/latest/3951 X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu This fixes an off-by-one allocation bug. Zoli *** Src/builtin.c 1997/07/13 05:24:42 3.1.3.3 --- Src/builtin.c 1997/09/16 04:37:28 3.1.3.4 *************** bin_read(char *name, char **args, char * *** 2792,2798 **** char d; /* allocate buffer space for result */ ! bptr = buf = (char *)zalloc(nchars); do { /* If read returns 0, is end of file */ --- 2792,2798 ---- char d; /* allocate buffer space for result */ ! bptr = buf = (char *)zalloc(nchars+1); do { /* If read returns 0, is end of file */ *************** bin_read(char *name, char **args, char * *** 2823,2829 **** if (!ops['e']) setsparam(reply, metafy(buf, bptr - buf, META_REALLOC)); else ! zfree(buf, bptr - buf); return val <= 0; } --- 2823,2829 ---- if (!ops['e']) setsparam(reply, metafy(buf, bptr - buf, META_REALLOC)); else ! zfree(buf, bptr - buf + 1); return val <= 0; }