Commit e98b6688 authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Fix bug: don't use cap() for max dirlist size, since we may use a

larger buffer.
parent 20b92a9a
......@@ -23,12 +23,14 @@ type DirEntry struct {
type DirEntryList struct {
buf []byte
size int
offset uint64
}
func NewDirEntryList(data []byte, off uint64) *DirEntryList {
return &DirEntryList{
buf: data[:0],
size: len(data),
offset: off,
}
}
......@@ -43,7 +45,7 @@ func (l *DirEntryList) Add(name string, inode uint64, mode uint32) bool {
oldLen := len(l.buf)
newLen := delta + oldLen
if newLen > cap(l.buf) {
if newLen > l.size {
return false
}
l.buf = l.buf[:newLen]
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment