From ebd4388cca5e28619970032e32ddeb2cb51a6b38 Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 6 Jan 2023 19:11:18 +0100 Subject: [PATCH] s3: Return XMinioInvalidObjectName if the object contains null char (#16372) --- cmd/object-api-utils.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/cmd/object-api-utils.go b/cmd/object-api-utils.go index 6891d95eb..c4f537351 100644 --- a/cmd/object-api-utils.go +++ b/cmd/object-api-utils.go @@ -170,6 +170,13 @@ func IsValidObjectPrefix(object string) bool { if strings.Contains(object, `//`) { return false } + // This is valid for AWS S3 but it will never + // work with file systems, we will reject here + // to return object name invalid rather than + // a cryptic error from the file system. + if strings.ContainsRune(object, 0) { + return false + } return true }