Explorar o código

- fix parse error when dpkg sends unexpected data

Michael Vogt %!s(int64=19) %!d(string=hai) anos
pai
achega
f26fcbc707
Modificáronse 2 ficheiros con 5 adicións e 3 borrados
  1. 4 3
      apt-pkg/deb/dpkgpm.cc
  2. 1 0
      debian/changelog

+ 4 - 3
apt-pkg/deb/dpkgpm.cc

@@ -392,14 +392,15 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
    //        statusfd or by rewriting the code here to deal with
    //        statusfd or by rewriting the code here to deal with
    //        it. for now we just ignore it and not crash
    //        it. for now we just ignore it and not crash
    TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]));
    TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]));
-   char *pkg = list[1];
-   char *action = _strstrip(list[2]);
-   if( pkg == NULL || action == NULL) 
+   if( list[0] == NULL || list[1] == NULL || list[2] == NULL) 
    {
    {
       if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
       if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
 	 std::clog << "ignoring line: not enough ':'" << std::endl;
 	 std::clog << "ignoring line: not enough ':'" << std::endl;
       return;
       return;
    }
    }
+   char *action = list[0];
+   char *pkg = list[1];
+   char *action = _strstrip(list[2]);
 
 
    if(strncmp(action,"error",strlen("error")) == 0)
    if(strncmp(action,"error",strlen("error")) == 0)
    {
    {

+ 1 - 0
debian/changelog

@@ -14,6 +14,7 @@ apt (0.7.7) UNRELEASED; urgency=low
     - merged dpkg-log branch, this lets you specify a 
     - merged dpkg-log branch, this lets you specify a 
       Dir::Log::Terminal file to log dpkg output to
       Dir::Log::Terminal file to log dpkg output to
       (ABI break)
       (ABI break)
+    - fix parse error when dpkg sends unexpected data
   * merged apt--sha256 branch to fully support the new
   * merged apt--sha256 branch to fully support the new
     sha256 checksums in the Packages and Release files
     sha256 checksums in the Packages and Release files
     (ABI break)
     (ABI break)