aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-08-29 10:29:00 -0400
committerRuss Cox <rsc@golang.org>2014-08-29 10:29:00 -0400
commit6f19fd438e2178d086c4352b439e857bd08051bd (patch)
tree03259fd3b1599669080f011cf6e86d03b9ee4ba7 /src
parente77c2fe31374905b08d51f338803bea88e9c4ec2 (diff)
downloadgo-6f19fd438e2178d086c4352b439e857bd08051bd.tar.xz
runtime: fix sprintf index out of bounds
Breaks on Plan 9, apparently. The other systems must not run sprintf during all.bash. I'd write a test but it's all going away. TBR=r CC=0intro, golang-codereviews https://golang.org/cl/133260044
Diffstat (limited to 'src')
-rw-r--r--src/pkg/runtime/print1.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/pkg/runtime/print1.go b/src/pkg/runtime/print1.go
index 9df6a621bb..f19cc1da59 100644
--- a/src/pkg/runtime/print1.go
+++ b/src/pkg/runtime/print1.go
@@ -46,7 +46,7 @@ func printf(s *byte) {
// It has the same problem as goprintf.
//go:nosplit
func snprintf(dst *byte, n int32, s *byte) {
- buf := (*[1 << 30]byte)(unsafe.Pointer(dst))[0:0:n]
+ buf := (*[1 << 30]byte)(unsafe.Pointer(dst))[0:n:n]
gp := getg()
gp.writebuf = buf[0:0 : n-1] // leave room for NUL, this is called from C