diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2019-08-29T13·22+0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-29T13·22+0200 |
commit | 84de8210040580ce7189332b43038d52c56a9689 (patch) | |
tree | 513d9ee70faf7ea4f60a75125f5262a27cc42146 /src/libstore | |
parent | 8478c99d09495485683c8442af640231622e9811 (diff) | |
parent | 693e68e09c9a17ca72b074bd2e575bf435647b45 (diff) |
Merge pull request #3069 from matthewbauer/max-name
Set maximum name length in Nix
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/store-api.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index f5608d3849f1..3bb9db0b723b 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -97,6 +97,10 @@ void checkStoreName(const string & name) reasons (e.g., "." and ".."). */ if (string(name, 0, 1) == ".") 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) if (!((i >= 'A' && i <= 'Z') || (i >= 'a' && i <= 'z') || |