From 8fe5ef40525d23012282a83a06a441863daa6bdb Mon Sep 17 00:00:00 2001 From: Shenghou Ma Date: Fri, 10 Oct 2014 20:30:24 -0400 Subject: [PATCH] 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 --- src/cmd/ld/macho.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/cmd/ld/macho.c b/src/cmd/ld/macho.c index 61306bb7ca719..fe7e10e466691 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++;