Commit f015c53a authored by Dean Prichard's avatar Dean Prichard Committed by Russ Cox

gc: avoid fixed length buffer cleanbuf

R=rsc
CC=golang-dev
https://golang.org/cl/302042
parent 5bebadf2
...@@ -290,7 +290,7 @@ importfile(Val *f, int line) ...@@ -290,7 +290,7 @@ importfile(Val *f, int line)
int32 c; int32 c;
int len; int len;
Strlit *path; Strlit *path;
char cleanbuf[1024]; char *cleanbuf;
// TODO(rsc): don't bother reloading imports more than once? // TODO(rsc): don't bother reloading imports more than once?
...@@ -310,7 +310,8 @@ importfile(Val *f, int line) ...@@ -310,7 +310,8 @@ importfile(Val *f, int line)
path = f->u.sval; path = f->u.sval;
if(islocalname(path)) { 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); cleanname(cleanbuf);
path = strlit(cleanbuf); path = strlit(cleanbuf);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment