From 6abe26994fd82bef9bc357055d1dc4feee261a4d Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Fri, 28 Aug 2009 21:07:55 +0200 Subject: * apt-pkg/acquire-item.cc: - do not segfault on invalid items (closes: #544080) --- apt-pkg/acquire-item.cc | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'apt-pkg') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 94341c81a..afb3daad3 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -596,21 +596,21 @@ void pkgAcqIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf) /*{{{*/ if(Desc.URI.substr(nameLen) != *t) continue; - // we want to try it with the next extension + // we want to try it with the next extension (and make sure to + // not skip over the end) t++; + if (t == types.end()) + break; - if (t != types.end()) - { - Desc.URI = Desc.URI.substr(0, nameLen) + *t; - - new pkgAcqIndex(Owner, RealURI, Desc.Description, Desc.ShortDesc, - ExpectedHash, string(".").append(*t)); - - Status = StatDone; - Complete = false; - Dequeue(); - return; - } + // queue new download + Desc.URI = Desc.URI.substr(0, nameLen) + *t; + new pkgAcqIndex(Owner, RealURI, Desc.Description, Desc.ShortDesc, + ExpectedHash, string(".").append(*t)); + + Status = StatDone; + Complete = false; + Dequeue(); + return; } // on decompression failure, remove bad versions in partial/ -- cgit v1.2.3