1
0
mirror of https://github.com/golang/go synced 2024-11-19 17:14:44 -07:00

cmd/dist: fix bug in bsubst

R=golang-dev, r, dsymonds, akumar
CC=golang-dev
https://golang.org/cl/5624054
This commit is contained in:
Alex Brainman 2012-02-05 15:16:39 +11:00
parent cdfd5b2bed
commit c06bd52a2e

5
src/cmd/dist/buf.c vendored Normal file → Executable file
View File

@ -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);