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 d799b2bb7e)
This commit is contained in:
Dimitry Ivanov 2016-05-24 14:29:56 -07:00
parent f1d4a49598
commit bda20e78f0

View file

@ -543,6 +543,9 @@ static void parse_LD_PRELOAD(const char* path) {
if (path != nullptr) { if (path != nullptr) {
// We have historically supported ':' as well as ' ' in LD_PRELOAD. // We have historically supported ':' as well as ' ' in LD_PRELOAD.
g_ld_preload_names = android::base::Split(path, " :"); 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(); });
} }
} }