diff options
Diffstat (limited to 'libgo/go/time/sys_plan9.go')
-rw-r--r-- | libgo/go/time/sys_plan9.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libgo/go/time/sys_plan9.go b/libgo/go/time/sys_plan9.go index 11365a7..9086a6e 100644 --- a/libgo/go/time/sys_plan9.go +++ b/libgo/go/time/sys_plan9.go @@ -19,6 +19,7 @@ func interrupt() { // readFile reads and returns the content of the named file. // It is a trivial implementation of ioutil.ReadFile, reimplemented // here to avoid depending on io/ioutil or os. +// It returns an error if name exceeds maxFileSize bytes. func readFile(name string) ([]byte, error) { f, err := syscall.Open(name, syscall.O_RDONLY) if err != nil { @@ -38,6 +39,9 @@ func readFile(name string) ([]byte, error) { if n == 0 || err != nil { break } + if len(ret) > maxFileSize { + return nil, fileSizeError(name) + } } return ret, err } |