Commit c06bd52a authored by Alex Brainman's avatar Alex Brainman

cmd/dist: fix bug in bsubst

R=golang-dev, r, dsymonds, akumar
CC=golang-dev
https://golang.org/cl/5624054
parent cdfd5b2b
......@@ -115,8 +115,11 @@ bsubst(Buf *b, char *x, char *y)
if(p == nil)
break;
if(nx != ny) {
if(nx < ny)
if(nx < ny) {
pos = p - b->p;
bgrow(b, ny-nx);
p = b->p + pos;
}
xmemmove(p+ny, p+nx, (b->p+b->len)-(p+nx));
}
xmemmove(p, y, ny);
......
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