changeset 18688:0eba324e27db

strcpy doesn't handle overlapping strings
author Tom Rodriguez <tom.rodriguez@oracle.com>
date Mon, 15 Dec 2014 12:56:22 -0800
parents 2885aafd812f
children 8923610115c9
files src/share/vm/compiler/compilerOracle.cpp
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/compiler/compilerOracle.cpp	Mon Dec 15 12:25:36 2014 -0800
+++ b/src/share/vm/compiler/compilerOracle.cpp	Mon Dec 15 12:56:22 2014 -0800
@@ -397,7 +397,8 @@
   int match = MethodMatcher::Exact;
   while (name[0] == '*') {
     match |= MethodMatcher::Suffix;
-    strcpy(name, name + 1);
+    // Copy remaining string plus NUL to the beginning
+    memcpy(name, name + 1, strlen(name + 1) + 1);
   }
 
   if (strcmp(name, "*") == 0) return MethodMatcher::Any;