tdc: cleanup, fix off-by-one memory error - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 272c1fb2d928168074798cf2a467591121273478
(DIR) parent 56e6f8f9946a5d59192d443625832671f9154ea8
(HTM) Author: Russ Cox <rsc@swtch.com>
Date: Sat, 6 Dec 2008 16:45:40 -0800
dc: cleanup, fix off-by-one memory error
Diffstat:
M src/cmd/dc.c | 16 +---------------
1 file changed, 1 insertion(+), 15 deletions(-)
---
(DIR) diff --git a/src/cmd/dc.c b/src/cmd/dc.c
t@@ -165,7 +165,6 @@ void release(Blk *p);
Blk* dcgetwd(Blk *p);
void putwd(Blk *p, Blk *c);
Blk* lookwd(Blk *p);
-char* nalloc(char *p, unsigned nbytes);
int getstk(void);
/********debug only**/
t@@ -1222,7 +1221,7 @@ init(int argc, char *argv[])
readptr = &readstk[0];
k=0;
sp = sptr = &symlst[0];
- while(sptr < &symlst[TBLSZ]) {
+ while(sptr < &symlst[TBLSZ-1]) {
sptr->next = ++sp;
sptr++;
}
t@@ -2268,19 +2267,6 @@ lookwd(Blk *p)
return(*wp->rdw);
}
-char*
-nalloc(char *p, unsigned nbytes)
-{
- char *q, *r;
-
- q = r = malloc(nbytes);
- if(q==0)
- return(0);
- while(nbytes--)
- *q++ = *p++;
- return(r);
-}
-
int
getstk(void)
{