[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
62/376: Be more strict about file names in NARs
From: |
Ludovic Courtès |
Subject: |
62/376: Be more strict about file names in NARs |
Date: |
Wed, 28 Jan 2015 22:04:03 +0000 |
civodul pushed a commit to tag 1.8
in repository guix.
commit 985f1595fe9f61095c7bc94b49be1179811ec630
Author: Eelco Dolstra <address@hidden>
Date: Wed Jul 16 16:30:50 2014 +0200
Be more strict about file names in NARs
---
src/libutil/archive.cc | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/src/libutil/archive.cc b/src/libutil/archive.cc
index dfe9653..9dc2ebe 100644
--- a/src/libutil/archive.cc
+++ b/src/libutil/archive.cc
@@ -231,7 +231,7 @@ static void parse(ParseSink & sink, Source & source, const
Path & path)
}
else if (s == "entry" && type == tpDirectory) {
- string name;
+ string name, prevName;
s = readString(source);
if (s != "(") throw badArchive("expected open tag");
@@ -245,6 +245,11 @@ static void parse(ParseSink & sink, Source & source, const
Path & path)
break;
} else if (s == "name") {
name = readString(source);
+ if (name.empty() || name == "." || name == ".." ||
name.find('/') != string::npos || name.find((char) 0) != string::npos)
+ throw Error(format("NAR contains invalid file name
`%1%'") % name);
+ if (name <= prevName)
+ throw Error("NAR directory is not sorted");
+ prevName = name;
if (useCaseHack) {
auto i = names.find(name);
if (i != names.end()) {
- 68/376: Ugly hack to fix building on old Darwin, (continued)
- 68/376: Ugly hack to fix building on old Darwin, Ludovic Courtès, 2015/01/28
- 75/376: nix-store --serve: Monitor for client disconnects, Ludovic Courtès, 2015/01/28
- 70/376: Better fix for strcasecmp on Darwin, Ludovic Courtès, 2015/01/28
- 73/376: startProcess: Make writing error messages from the child more robust, Ludovic Courtès, 2015/01/28
- 67/376: nix-daemon: Add trusted-users and allowed-users options, Ludovic Courtès, 2015/01/28
- 56/376: Remove cruft, Ludovic Courtès, 2015/01/28
- 76/376: nix-daemon: Simplify stderr handling, Ludovic Courtès, 2015/01/28
- 71/376: Revert old useBuildHook behaviour, Ludovic Courtès, 2015/01/28
- 65/376: nix-daemon: Only print connection info if we have SO_PEERCRED, Ludovic Courtès, 2015/01/28
- 69/376: Bump, Ludovic Courtès, 2015/01/28
- 62/376: Be more strict about file names in NARs,
Ludovic Courtès <=
- 78/376: Pass -pthread only for programs that need it, Ludovic Courtès, 2015/01/28
- 80/376: Remove some dead code, Ludovic Courtès, 2015/01/28
- 72/376: Remove dead code, Ludovic Courtès, 2015/01/28
- 81/376: Add some assertions, Ludovic Courtès, 2015/01/28
- 82/376: More debugging, Ludovic Courtès, 2015/01/28
- 85/376: tests/remote-builds.nix: Don't try cache.nixos.org, Ludovic Courtès, 2015/01/28
- 79/376: Remove some obsolete files, Ludovic Courtès, 2015/01/28
- 83/376: Fix bogus pass by reference, Ludovic Courtès, 2015/01/28
- 88/376: Refactor, Ludovic Courtès, 2015/01/28
- 87/376: tests/remote-builds.nix: Test failing build, Ludovic Courtès, 2015/01/28