From: Russ Cox Date: Thu, 14 Mar 2013 18:35:47 +0000 (-0400) Subject: cmd/ld: another use-after-free X-Git-Tag: go1.1rc2~508 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8bbb6d3ed04ed0d79438045bb8d56b8c03a42944;p=gostls13.git cmd/ld: another use-after-free This only shows up in the duplicate symbol error message. R=golang-dev, r CC=golang-dev https://golang.org/cl/7486053 --- diff --git a/src/cmd/5l/obj.c b/src/cmd/5l/obj.c index d25fefebba..f70cb6c336 100644 --- a/src/cmd/5l/obj.c +++ b/src/cmd/5l/obj.c @@ -428,6 +428,7 @@ ldobj1(Biobuf *f, char *pkg, int64 len, char *pn) ntext = 0; eof = Boffset(f) + len; src[0] = 0; + pn = estrdup(pn); // we keep it in Sym* references newloop: memset(h, 0, sizeof(h)); diff --git a/src/cmd/6l/obj.c b/src/cmd/6l/obj.c index 6ea88de273..91569794bf 100644 --- a/src/cmd/6l/obj.c +++ b/src/cmd/6l/obj.c @@ -423,6 +423,7 @@ ldobj1(Biobuf *f, char *pkg, int64 len, char *pn) ntext = 0; eof = Boffset(f) + len; src[0] = 0; + pn = estrdup(pn); // we keep it in Sym* references newloop: memset(h, 0, sizeof(h)); diff --git a/src/cmd/8l/obj.c b/src/cmd/8l/obj.c index ad453064cc..14c6b6aa97 100644 --- a/src/cmd/8l/obj.c +++ b/src/cmd/8l/obj.c @@ -444,7 +444,7 @@ ldobj1(Biobuf *f, char *pkg, int64 len, char *pn) ntext = 0; eof = Boffset(f) + len; src[0] = 0; - + pn = estrdup(pn); // we keep it in Sym* references newloop: memset(h, 0, sizeof(h));