diff options
author | gVisor bot <gvisor-bot@google.com> | 2019-11-26 17:21:43 -0800 |
---|---|---|
committer | gVisor bot <gvisor-bot@google.com> | 2019-11-26 17:21:43 -0800 |
commit | 4a620c436dabbb0d5036e137bfdd44b945e3cff0 (patch) | |
tree | d9a62601cb2ca9b9b5f8f6ea9a9a46fece164769 /runsc | |
parent | 519ceabdf90129664fa1f70f49d0472a9106910f (diff) | |
parent | f697d1a33e4e7cefb4164ec977c38ccc2a228099 (diff) |
Merge pull request #981 from tanjianfeng:fix-898
PiperOrigin-RevId: 282669859
Diffstat (limited to 'runsc')
-rw-r--r-- | runsc/fsgofer/fsgofer.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/runsc/fsgofer/fsgofer.go b/runsc/fsgofer/fsgofer.go index 9117d9616..c9add64ec 100644 --- a/runsc/fsgofer/fsgofer.go +++ b/runsc/fsgofer/fsgofer.go @@ -956,14 +956,14 @@ func (l *localFile) Readdir(offset uint64, count uint32) ([]p9.Dirent, error) { } func (l *localFile) readDirent(f int, offset uint64, count uint32, skip uint64) ([]p9.Dirent, error) { + var dirents []p9.Dirent + // Limit 'count' to cap the slice size that is returned. const maxCount = 100000 if count > maxCount { count = maxCount } - dirents := make([]p9.Dirent, 0, count) - // Pre-allocate buffers that will be reused to get partial results. direntsBuf := make([]byte, 8192) names := make([]string, 0, 100) |