From bd889907228024c1c682e86859611002e894abf8 Mon Sep 17 00:00:00 2001 From: Akshat Kumar Date: Thu, 28 Feb 2013 14:20:42 -0800 Subject: [PATCH] os: Plan 9: allocate space for a string in Rename The Name field of the stat structure is variable length and the marshalling code in package syscall requires a buf long enough to contain the Name as well as the static data. This change makes sure that the buffer in os.Rename is allocated with the appropriate length. R=rsc, rminnich, ality, r CC=golang-dev https://golang.org/cl/7453044 --- src/pkg/os/file_plan9.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pkg/os/file_plan9.go b/src/pkg/os/file_plan9.go index 595275af20..d6d39a8997 100644 --- a/src/pkg/os/file_plan9.go +++ b/src/pkg/os/file_plan9.go @@ -308,7 +308,7 @@ func Rename(oldname, newname string) error { d.Null() d.Name = newname - var buf [syscall.STATFIXLEN]byte + buf := make([]byte, syscall.STATFIXLEN+len(d.Name)) n, err := d.Marshal(buf[:]) if err != nil { return &PathError{"rename", oldname, err} -- 2.48.1