Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: runtime/vm/kernel.cc

Issue 2794113003: VM [KERNEL] Fix a buffer overflow in COMPARE_NAME (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel.cc
diff --git a/runtime/vm/kernel.cc b/runtime/vm/kernel.cc
index 6953cea46d1e422c17a00c924b2534c468227bfc..ea314283a138ea34a4042a9ee5c7575848d02cf8 100644
--- a/runtime/vm/kernel.cc
+++ b/runtime/vm/kernel.cc
@@ -80,7 +80,9 @@ bool CanonicalName::IsMember() {
// Note the two occurrences of the parameter 'literal'.
#define COMPARE_NAME(canonical_name, literal) \
- memcmp((canonical_name)->name()->buffer(), (literal), strlen(literal)) == 0
+ ((canonical_name)->name()->size() == strlen(literal) && \
+ memcmp((canonical_name)->name()->buffer(), (literal), strlen(literal)) == \
+ 0)
bool CanonicalName::IsField() {
// Fields with private names have the import URI of the library where they are
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698