Remove artificial name length check.
This should be determined by the filesystem. PiperOrigin-RevId: 218376553 Change-Id: I55d176e2cdf8acdd6642789af057b98bb8ca25b8
This commit is contained in:
parent
692df85673
commit
ce3a762038
|
@ -27,8 +27,6 @@ import (
|
||||||
"gvisor.googlesource.com/gvisor/pkg/log"
|
"gvisor.googlesource.com/gvisor/pkg/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
const maximumNameLength = 255
|
|
||||||
|
|
||||||
// ExtractErrno extracts a syscall.Errno from a error, best effort.
|
// ExtractErrno extracts a syscall.Errno from a error, best effort.
|
||||||
func ExtractErrno(err error) syscall.Errno {
|
func ExtractErrno(err error) syscall.Errno {
|
||||||
switch err {
|
switch err {
|
||||||
|
@ -109,13 +107,10 @@ func (t *Tflush) handle(cs *connState) message {
|
||||||
|
|
||||||
// checkSafeName validates the name and returns nil or returns an error.
|
// checkSafeName validates the name and returns nil or returns an error.
|
||||||
func checkSafeName(name string) error {
|
func checkSafeName(name string) error {
|
||||||
if name == "" || strings.Contains(name, "/") || name == "." || name == ".." {
|
if name != "" && !strings.Contains(name, "/") && name != "." && name != ".." {
|
||||||
return syscall.EINVAL
|
return nil
|
||||||
}
|
}
|
||||||
if len(name) > maximumNameLength {
|
return syscall.EINVAL
|
||||||
return syscall.ENAMETOOLONG
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// handle implements handler.handle.
|
// handle implements handler.handle.
|
||||||
|
@ -979,11 +974,6 @@ func (t *Tstatfs) handle(cs *connState) message {
|
||||||
return newErr(err)
|
return newErr(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Constrain the name length.
|
|
||||||
if st.NameLength > maximumNameLength {
|
|
||||||
st.NameLength = maximumNameLength
|
|
||||||
}
|
|
||||||
|
|
||||||
return &Rstatfs{st}
|
return &Rstatfs{st}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue