Details
Description
Right now if we pass an index spec with the 'name' field set to "f\0o", for example, then getting the string representation from the BSON element, using valueStringData(), returns "f". After this, we check if the string representation contains '\0', which could be safely removed since we should never encounter this scenario.
const StringData name = nameElem.valueStringData(); |
if (name.find('\0') != std::string::npos) |
return Status(ErrorCodes::CannotCreateIndex, "index name cannot contain NUL bytes"); |
See here