From 429effb963fba7529b8ff57d6b0474916d4fed69 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 10 Mar 2020 10:46:56 +0100 Subject: Don't crash pattern matching sections if pkg has no section Packages from third-party sources do not always follow the established patterns of more properly maintained archives. In that case it was a driver package for a scanner&printer device which has only a minimum of info attached, but also minimal non-installed packages do not include sections, so we really shouldn't assume their availability. --- apt-pkg/cachefilter-patterns.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg') diff --git a/apt-pkg/cachefilter-patterns.cc b/apt-pkg/cachefilter-patterns.cc index 5a58a9767..bc0eece30 100644 --- a/apt-pkg/cachefilter-patterns.cc +++ b/apt-pkg/cachefilter-patterns.cc @@ -501,7 +501,7 @@ BaseRegexMatcher::BaseRegexMatcher(std::string const &Pattern) } bool BaseRegexMatcher::operator()(const char *string) { - if (unlikely(pattern == NULL)) + if (unlikely(pattern == nullptr) || string == nullptr) return false; else return regexec(pattern, string, 0, 0, 0) == 0; -- cgit v1.2.3-70-g09d2