From 9f8dc31b50aca20db24bcea32fea249b2ac658ba Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Wed, 8 Apr 2020 23:36:49 +0200 Subject: input/Plugin: copy protocols() to stack before using it Fixes regression by commit 015cbff93da causing a crash bug because the iterators of two different temporaries were used. --- src/input/InputPlugin.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/input') diff --git a/src/input/InputPlugin.cxx b/src/input/InputPlugin.cxx index f66af0f48..a1070a58d 100644 --- a/src/input/InputPlugin.cxx +++ b/src/input/InputPlugin.cxx @@ -33,7 +33,8 @@ InputPlugin::SupportsUri(const char *uri) const noexcept if (StringStartsWithIgnoreCase(uri, *i)) return true; } else { - return std::any_of(protocols().begin(), protocols().end(), [uri](const auto &schema) + const auto p = protocols(); + return std::any_of(p.begin(), p.end(), [uri](const auto &schema) { return StringStartsWithIgnoreCase(uri, schema.c_str()); } ); } return false; -- cgit v1.2.3