From bda20e78f0f314dbbf0f0bbcf0740cf2d6a4b85e Mon Sep 17 00:00:00 2001 From: Dimitry Ivanov Date: Tue, 24 May 2016 14:29:56 -0700 Subject: [PATCH] Correctly handle the case of empty LD_PRELOAD entries Previous android versions ignored empty entries for LD_PRELOAD Bug: http://b/28936779 Change-Id: I757478fe0c604ee378186511cb13b757fd9a9864 (cherry picked from commit d799b2bb7e9335786ab4596757d871e4a7722ff0) --- linker/linker.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/linker/linker.cpp b/linker/linker.cpp index 98362106c..39aa2caec 100644 --- a/linker/linker.cpp +++ b/linker/linker.cpp @@ -543,6 +543,9 @@ static void parse_LD_PRELOAD(const char* path) { if (path != nullptr) { // We have historically supported ':' as well as ' ' in LD_PRELOAD. g_ld_preload_names = android::base::Split(path, " :"); + std::remove_if(g_ld_preload_names.begin(), + g_ld_preload_names.end(), + [] (const std::string& s) { return s.empty(); }); } }