From: Shenghou Ma Date: Sat, 11 Oct 2014 00:30:24 +0000 (-0400) Subject: cmd/ld: fix off-by-one error when emitting symbol names X-Git-Tag: go1.4beta1~140 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=8fe5ef40525d23012282a83a06a441863daa6bdb;p=gostls13.git cmd/ld: fix off-by-one error when emitting symbol names I diffed the output of `nm -n gofmt' before and after this change, and verified that all changes are correct and all corrupted symbol names are fixed. Fixes #8906. LGTM=iant, cookieo9 R=golang-codereviews, iant, cookieo9 CC=golang-codereviews https://golang.org/cl/159750043 --- diff --git a/src/cmd/ld/macho.c b/src/cmd/ld/macho.c index 61306bb7ca..fe7e10e466 100644 --- a/src/cmd/ld/macho.c +++ b/src/cmd/ld/macho.c @@ -590,8 +590,7 @@ machosymtab(void) if(strstr(s->extname, "·") == nil) { addstring(symstr, s->extname); } else { - p = s->extname; - while (*p++ != '\0') { + for(p = s->extname; *p; p++) { if((uchar)*p == 0xc2 && (uchar)*(p+1) == 0xb7) { adduint8(ctxt, symstr, '.'); p++;