From ce3a762038006429b1eb3b855d4e9c5d700edfda Mon Sep 17 00:00:00 2001 From: Adin Scannell Date: Tue, 23 Oct 2018 11:26:31 -0700 Subject: [PATCH] Remove artificial name length check. This should be determined by the filesystem. PiperOrigin-RevId: 218376553 Change-Id: I55d176e2cdf8acdd6642789af057b98bb8ca25b8 --- pkg/p9/handlers.go | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/pkg/p9/handlers.go b/pkg/p9/handlers.go index 0d7a6138f..d3f38e4bf 100644 --- a/pkg/p9/handlers.go +++ b/pkg/p9/handlers.go @@ -27,8 +27,6 @@ import ( "gvisor.googlesource.com/gvisor/pkg/log" ) -const maximumNameLength = 255 - // ExtractErrno extracts a syscall.Errno from a error, best effort. func ExtractErrno(err error) syscall.Errno { switch err { @@ -109,13 +107,10 @@ func (t *Tflush) handle(cs *connState) message { // checkSafeName validates the name and returns nil or returns an error. func checkSafeName(name string) error { - if name == "" || strings.Contains(name, "/") || name == "." || name == ".." { - return syscall.EINVAL + if name != "" && !strings.Contains(name, "/") && name != "." && name != ".." { + return nil } - if len(name) > maximumNameLength { - return syscall.ENAMETOOLONG - } - return nil + return syscall.EINVAL } // handle implements handler.handle. @@ -979,11 +974,6 @@ func (t *Tstatfs) handle(cs *connState) message { return newErr(err) } - // Constrain the name length. - if st.NameLength > maximumNameLength { - st.NameLength = maximumNameLength - } - return &Rstatfs{st} }