]> git.saurik.com Git - apt.git/commitdiff
Do not crash in 'apt show' for non-installed packages
authorJulian Andres Klode <jak@debian.org>
Mon, 17 Aug 2015 08:10:57 +0000 (10:10 +0200)
committerJulian Andres Klode <jak@debian.org>
Mon, 17 Aug 2015 08:10:57 +0000 (10:10 +0200)
For a non-installed package, manual_installed was set to the null
pointer. This was passed to Tag::Rewrite, which expects an string
(empty for null-type values) and the conversion from null pointer
to string does not work correctly.

apt-private/private-show.cc

index 790bc0092b05730f9d3bb504a0676a8480f208b1..3a393b7460fea4ab7acb37f24b3bdfd6fc038c26 100644 (file)
@@ -94,7 +94,7 @@ static bool DisplayRecord(pkgCacheFile &CacheFile, pkgCache::VerIterator V,
    if (is_installed)
       manual_installed = !(state.Flags & pkgCache::Flag::Auto) ? "yes" : "no";
    else
    if (is_installed)
       manual_installed = !(state.Flags & pkgCache::Flag::Auto) ? "yes" : "no";
    else
-      manual_installed = 0;
+      manual_installed = "";
 
    // FIXME: add verbose that does not do the removal of the tags?
    std::vector<pkgTagSection::Tag> RW;
 
    // FIXME: add verbose that does not do the removal of the tags?
    std::vector<pkgTagSection::Tag> RW;