From 6948d87872cba88254e54d4b5699e0e4496c3491 Mon Sep 17 00:00:00 2001 From: Ilho Kim Date: Wed, 6 Apr 2022 13:49:57 +0900 Subject: [PATCH] Fix metadata filter when using cached app info when compare metadata value using metadat filter there is need to check the exact matching of values using 'strcmp' not 'strstr' Change-Id: I61f85c4a3e50278077730eb7190caeb0f6b484eb Signed-off-by: Ilho Kim --- src/server/database/db_handle_provider.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/server/database/db_handle_provider.cc b/src/server/database/db_handle_provider.cc index d5b9a44..013c8e9 100644 --- a/src/server/database/db_handle_provider.cc +++ b/src/server/database/db_handle_provider.cc @@ -432,9 +432,12 @@ std::vector> DBHandleProvider::GetApplications( auto* node = reinterpret_cast(it->data); if (node->key != nullptr) { auto metadata = metadata_map.find(node->key); - if (metadata != metadata_map.end() && - strstr(node->value ? node->value : "", - metadata->second.c_str()) != nullptr) { + if (metadata == metadata_map.end()) + continue; + + if (metadata->second.empty() || + strcmp(node->value ? node->value : "", + metadata->second.c_str()) == 0) { pass = true; break; } -- 2.7.4