From ed94a0d6f60e7b236a3b62dd9d4d453e956cfcf9 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 30 Oct 2006 10:39:18 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - fix segfault if dpkg sends multiline error messages --- apt-pkg/deb/dpkgpm.cc | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 2b167dbf6..4c44cd01a 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -624,15 +624,20 @@ bool pkgDPkgPM::Go(int OutStatusFd) */ char* list[5]; - if(!TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]))) - // FIXME: dpkg sends multiline error messages sometimes (see - // #374195 for a example. we should support this by - // either patching dpkg to not send multiline over the - // statusfd or by rewriting the code here to deal with - // it. for now we just ignore it and not crash - continue; + // dpkg sends multiline error messages sometimes (see + // #374195 for a example. we should support this by + // either patching dpkg to not send multiline over the + // statusfd or by rewriting the code here to deal with + // it. for now we just ignore it and not crash + TokSplitString(':', line, list, sizeof(list)/sizeof(list[0])); char *pkg = list[1]; char *action = _strstrip(list[2]); + if( pkg == NULL || action == NULL) + { + if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) + std::clog << "ignoring line: not enough ':'" << std::endl; + continue; + } if(strncmp(action,"error",strlen("error")) == 0) { -- cgit v1.2.3 From 7882f8fed5bc1232ec51b54b06bf86bfad3d4e18 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Tue, 31 Oct 2006 20:06:34 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - reset the line if a invalid line was read --- apt-pkg/deb/dpkgpm.cc | 2 ++ 1 file changed, 2 insertions(+) (limited to 'apt-pkg/deb') diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 4c44cd01a..c7a6b921f 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -636,6 +636,8 @@ bool pkgDPkgPM::Go(int OutStatusFd) { if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true) std::clog << "ignoring line: not enough ':'" << std::endl; + // reset the line buffer + line[0]=0; continue; } -- cgit v1.2.3