aboutsummaryrefslogtreecommitdiff
path: root/src/debug
diff options
context:
space:
mode:
Diffstat (limited to 'src/debug')
-rw-r--r--src/debug/macho/file.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/debug/macho/file.go b/src/debug/macho/file.go
index 7b9e83e5a8..da5d9cad4c 100644
--- a/src/debug/macho/file.go
+++ b/src/debug/macho/file.go
@@ -545,8 +545,9 @@ func (f *File) pushSection(sh *Section, r io.ReaderAt) error {
}
func cstring(b []byte) string {
- var i int
- for i = 0; i < len(b) && b[i] != 0; i++ {
+ i := bytes.IndexByte(b, 0)
+ if i == -1 {
+ i = len(b)
}
return string(b[0:i])
}