From 8b0b6f413d3cd8f16f13e26f401b838b859d1ed6 Mon Sep 17 00:00:00 2001 From: Julien Boeuf Date: Tue, 22 Sep 2015 13:31:16 -0700 Subject: It is a bad idea to have a map with string_refs as output params. This is very much unsafe as the string_ref could point on a stack variable of the callee. --- test/cpp/end2end/end2end_test.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'test/cpp/end2end/end2end_test.cc') diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index b3cfcd51a7..5017e8a230 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -121,7 +121,7 @@ class TestMetadataCredentialsPlugin : public MetadataCredentialsPlugin { bool IsBlocking() const GRPC_OVERRIDE { return is_blocking_; } Status GetMetadata(grpc::string_ref service_url, - std::multimap* metadata) + std::multimap* metadata) GRPC_OVERRIDE { EXPECT_GT(service_url.length(), 0UL); EXPECT_TRUE(metadata != nullptr); @@ -175,9 +175,9 @@ class TestAuthMetadataProcessor : public AuthMetadataProcessor { if (auth_md_value == kGoodGuy) { context->AddProperty(kIdentityPropName, kGoodGuy); context->SetPeerIdentityPropertyName(kIdentityPropName); - consumed_auth_metadata->insert( - std::make_pair(string(auth_md->first.data(), auth_md->first.length()), - auth_md->second)); + consumed_auth_metadata->insert(std::make_pair( + string(auth_md->first.data(), auth_md->first.length()), + string(auth_md->second.data(), auth_md->second.length()))); return Status::OK; } else { return Status(StatusCode::UNAUTHENTICATED, -- cgit v1.2.3