[devel] [PATCH for apt v2 17/21] Fix access after free error

Aleksei Nikiforov darktemplar на altlinux.org
Чт Дек 12 12:57:26 MSK 2019


Found via clang-static-analyzer:
Memory error: Use-after-free:
Use of memory after it is freed
---
 apt/cmdline/rpmindexcopy.cc | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/apt/cmdline/rpmindexcopy.cc b/apt/cmdline/rpmindexcopy.cc
index 9604d4b..6d5a414 100644
--- a/apt/cmdline/rpmindexcopy.cc
+++ b/apt/cmdline/rpmindexcopy.cc
@@ -111,8 +111,10 @@ bool RPMIndexCopy::CopyPackages(const string &CDROM,const string &Name,vector<st
 	    SetCloseExec(STDIN_FILENO,false);
 	    SetCloseExec(STDOUT_FILENO,false);
 	    
+	    std::string arg_0 = _config->Find("Dir::Bin::bzip2","bzip2");
+
 	    const char *Args[3];
-	    Args[0] = _config->Find("Dir::Bin::bzip2","bzip2").c_str();
+	    Args[0] = arg_0.c_str();
 	    Args[1] = "-d";
 	    Args[2] = 0;
 	    execvp(Args[0],(char **)Args);
-- 
2.24.1



Подробная информация о списке рассылки Devel