summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2020-03-10 10:46:56 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2020-03-10 10:57:21 +0100
commit429effb963fba7529b8ff57d6b0474916d4fed69 (patch)
tree03b4542b489fee18bfe2918acea7fdc3dc33e14c /apt-pkg
parent61ebf627f766eb7f189042fc216bb822ac0ef7f4 (diff)
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.
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/cachefilter-patterns.cc2
1 files changed, 1 insertions, 1 deletions
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;