Skip to content

Commit 3386f13

Browse files
committed
[runtime] Fix -Wstringop-overread
1 parent a98cde4 commit 3386f13

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

runtime/executor/method_meta.cpp

+5-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,11 @@ bool MethodMeta::uses_backend(const char* backend_name) const {
233233
const auto delegates = s_plan_->delegates();
234234
for (size_t i = 0; i < delegates->size(); i++) {
235235
auto delegate = delegates->Get(i);
236-
if (std::strcmp(delegate->id()->c_str(), backend_name) == 0) {
236+
auto backend_name_len = std::strlen(backend_name);
237+
auto delegate_id_len = delegate->id()->size();
238+
if (backend_name_len == delegate_id_len &&
239+
std::strncmp(delegate->id()->c_str(), backend_name, backend_name_len) ==
240+
0) {
237241
return true;
238242
}
239243
}

0 commit comments

Comments
 (0)