mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 14:06:16 +02:00
Merge pull request #3069 from matthewbauer/max-name
Set maximum name length in Nix
This commit is contained in:
commit
84de821004
1 changed files with 4 additions and 0 deletions
|
@ -97,6 +97,10 @@ void checkStoreName(const string & name)
|
||||||
reasons (e.g., "." and ".."). */
|
reasons (e.g., "." and ".."). */
|
||||||
if (string(name, 0, 1) == ".")
|
if (string(name, 0, 1) == ".")
|
||||||
throw Error(baseError % "it is illegal to start the name with a period");
|
throw Error(baseError % "it is illegal to start the name with a period");
|
||||||
|
/* Disallow names longer than 211 characters. ext4’s max is 256,
|
||||||
|
but we need extra space for the hash and .chroot extensions. */
|
||||||
|
if (name.length() > 211)
|
||||||
|
throw Error(baseError % "name must be less than 212 characters");
|
||||||
for (auto & i : name)
|
for (auto & i : name)
|
||||||
if (!((i >= 'A' && i <= 'Z') ||
|
if (!((i >= 'A' && i <= 'Z') ||
|
||||||
(i >= 'a' && i <= 'z') ||
|
(i >= 'a' && i <= 'z') ||
|
||||||
|
|
Loading…
Reference in a new issue