summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cachefilter-patterns.cc3
-rw-r--r--apt-pkg/cachefilter-patterns.h2
2 files changed, 4 insertions, 1 deletions
diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc
index 1c92a7b1f..5a58a9767 100644
--- a/apt-pkg/cachefilter-patterns.cc
+++ b/apt-pkg/cachefilter-patterns.cc
@@ -263,6 +263,9 @@ std::unique_ptr<PatternTreeParser::Node> PatternTreeParser::parsePattern()
node->term = sentence.substr(node->start, state.offset - node->start);
+ if (node->term.size() <= 1)
+ throw Error{*node, "Pattern must have a term/name"};
+
node->end = skipSpace();
// We don't have any arguments, return node;
if (sentence[state.offset] != '(')
diff --git a/apt-pkg/cachefilter-patterns.h b/apt-pkg/cachefilter-patterns.h
index e79702af8..4eeb68594 100644
--- a/apt-pkg/cachefilter-patterns.h
+++ b/apt-pkg/cachefilter-patterns.h
@@ -92,9 +92,9 @@ struct PatternTreeParser
/// There may not be anything before or after the pattern, except for
/// whitespace.
std::unique_ptr<Node> parseTop();
+ std::unique_ptr<Node> parse(); // public for test cases only
private:
- std::unique_ptr<Node> parse();
std::unique_ptr<Node> parseOr();
std::unique_ptr<Node> parseAnd();
std::unique_ptr<Node> parseUnary();