Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: fix read -k coredump
- X-seq: zsh-workers 3951
- From: Zoltan Hidvegi <hzoli@xxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx (Zsh hacking and development)
- Subject: PATCH: fix read -k coredump
- Date: Fri, 8 May 1998 01:25:41 -0500 (CDT)
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;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author