* PATCH: fix read -k coredump
@ 1998-05-08 6:25 Zoltan Hidvegi
0 siblings, 0 replies; only message in thread
From: Zoltan Hidvegi @ 1998-05-08 6:25 UTC (permalink / raw)
To: Zsh hacking and development
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;
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1998-05-08 6:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-05-08 6:25 PATCH: fix read -k coredump Zoltan Hidvegi
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
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).