summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2014-03-17 13:43:12 +0100
committerMichael Vogt <mvo@ubuntu.com>2014-04-04 08:15:58 +0200
commit5e8589ae8f7b448f8f5a27077db55ef9bc9897ce (patch)
treef6e40349c0488bf4847ce73539062b4597d88569
parent77ef358f2967331b90b45c425f33f517ab64210f (diff)
apt-inst: Do not try to create a substring of an empty string in error reporting
One of our compressors (the empty one) has an empty extension. Calling substr on it fails.
-rw-r--r--apt-inst/deb/debfile.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/apt-inst/deb/debfile.cc b/apt-inst/deb/debfile.cc
index a811bbe88..8f2a83547 100644
--- a/apt-inst/deb/debfile.cc
+++ b/apt-inst/deb/debfile.cc
@@ -118,8 +118,10 @@ bool debDebFile::ExtractTarMember(pkgDirStream &Stream,const char *Name)
{
std::string ext = std::string(Name) + ".{";
for (std::vector<APT::Configuration::Compressor>::const_iterator c = compressor.begin();
- c != compressor.end(); ++c)
- ext.append(c->Extension.substr(1));
+ c != compressor.end(); ++c) {
+ if (!c->Extension.empty())
+ ext.append(c->Extension.substr(1));
+ }
ext.append("}");
return _error->Error(_("Internal error, could not locate member %s"), ext.c_str());
}