1
0
mirror of https://github.com/golang/go synced 2024-11-20 04:54:44 -07:00

gc: avoid fixed length buffer cleanbuf

R=rsc
CC=golang-dev
https://golang.org/cl/302042
This commit is contained in:
Dean Prichard 2010-03-08 17:00:14 -08:00 committed by Russ Cox
parent 5bebadf23f
commit f015c53ada

View File

@ -290,7 +290,7 @@ importfile(Val *f, int line)
int32 c;
int len;
Strlit *path;
char cleanbuf[1024];
char *cleanbuf;
// TODO(rsc): don't bother reloading imports more than once?
@ -310,7 +310,8 @@ importfile(Val *f, int line)
path = f->u.sval;
if(islocalname(path)) {
snprint(cleanbuf, sizeof cleanbuf, "%s/%s", pathname, path->s);
cleanbuf = mal(strlen(pathname) + strlen(path->s) + 2);
sprint(cleanbuf, "%s/%s", pathname, path->s);
cleanname(cleanbuf);
path = strlit(cleanbuf);
}