diff options
author | David Kalnischkies <david@kalnischkies.de> | 2016-05-20 09:37:24 +0200 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-05-20 09:37:24 +0200 |
commit | fdf9eef4d96a18d0167708499c993e1174251e88 (patch) | |
tree | 049dd9a8405ac4a3a489a02475ad57235e1538f5 /apt-private/private-depends.cc | |
parent | 91be4122fb4dba065c19ea3f292b1945a94b5d99 (diff) |
fail instead of segfault on unreadable config files
The report mentions "apt list --upgradable", but there are others which
have inconsistent behavior ranging from segfaulting to doing something
with the partial (and hence incomplete) data. We had a recent report
about sources.list (#818628), this one mentions prefences, the obvious
next step is conf files… so the testcase is adapted to check for all
three in file and directory versions and run a bunch of commands each
time which should all have more or less the same behavior in such a case
(aka error out).
Closes: 824503
Diffstat (limited to 'apt-private/private-depends.cc')
-rw-r--r-- | apt-private/private-depends.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/apt-private/private-depends.cc b/apt-private/private-depends.cc index 955f3dc67..3a3a2737a 100644 --- a/apt-private/private-depends.cc +++ b/apt-private/private-depends.cc @@ -26,8 +26,8 @@ static bool ShowDepends(CommandLine &CmdL, bool const RevDepends) { pkgCacheFile CacheFile; - pkgCache *Cache = CacheFile.GetPkgCache(); - if (unlikely(Cache == NULL)) + pkgCache * const Cache = CacheFile.GetPkgCache(); + if (unlikely(Cache == nullptr || CacheFile.GetDepCache() == nullptr)) return false; CacheSetHelperVirtuals helper(false); |