mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Handle arbitrarily large Fuse Dirent Namelen.
If FUSEDirent.Namelen is larger than the remaining payload size, then the dirent is probably invalid. We should skip it. PiperOrigin-RevId: 566678679
This commit is contained in:
@@ -985,7 +985,7 @@ func (r *FUSEDirent) shiftNextDirent(buf []byte) []byte {
|
||||
func (r *FUSEDirent) UnmarshalBytes(src []byte) []byte {
|
||||
srcP := r.Meta.UnmarshalBytes(src)
|
||||
|
||||
if r.Meta.NameLen > FUSE_NAME_MAX {
|
||||
if r.Meta.NameLen > FUSE_NAME_MAX || r.Meta.NameLen > uint32(len(srcP)) {
|
||||
// The name is too long and therefore invalid. We don't
|
||||
// need to unmarshal the name since it'll be thrown away.
|
||||
return r.shiftNextDirent(src)
|
||||
|
||||
Reference in New Issue
Block a user