diff options
author | Ian Lance Taylor <iant@golang.org> | 2017-09-14 17:11:35 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2017-09-14 17:11:35 +0000 |
commit | bc998d034f45d1828a8663b2eed928faf22a7d01 (patch) | |
tree | 8d262a22ca7318f4bcd64269fe8fe9e45bcf8d0f /libgo/go/time/sys_unix.go | |
parent | a41a6142df74219f596e612d3a7775f68ca6e96f (diff) | |
download | gcc-bc998d034f45d1828a8663b2eed928faf22a7d01.tar.gz |
libgo: update to go1.9
Reviewed-on: https://go-review.googlesource.com/63753
From-SVN: r252767
Diffstat (limited to 'libgo/go/time/sys_unix.go')
-rw-r--r-- | libgo/go/time/sys_unix.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/libgo/go/time/sys_unix.go b/libgo/go/time/sys_unix.go index 4c68bbdc6d1..57152751800 100644 --- a/libgo/go/time/sys_unix.go +++ b/libgo/go/time/sys_unix.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, 0) 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 } |