hotspot/src/share/vm/adlc/formssel.cpp
changeset 38658 34f9c45625d8
parent 36316 7a83de7aabca
child 39419 cc993a4ab581
--- a/hotspot/src/share/vm/adlc/formssel.cpp	Mon May 09 23:49:22 2016 -0700
+++ b/hotspot/src/share/vm/adlc/formssel.cpp	Tue May 03 12:23:06 2016 +0200
@@ -1499,7 +1499,8 @@
 // twice, we need to check that the operands are pointer-eequivalent in
 // the DFA during the labeling process.
 Predicate *InstructForm::build_predicate() {
-  char buf[1024], *s=buf;
+  const int buflen = 1024;
+  char buf[buflen], *s=buf;
   Dict names(cmpstr,hashstr,Form::arena);       // Map Names to counts
 
   MatchNode *mnode =
@@ -1508,12 +1509,12 @@
 
   uint first = 1;
   // Start with the predicate supplied in the .ad file.
-  if( _predicate ) {
-    if( first ) first=0;
-    strcpy(s,"("); s += strlen(s);
-    strcpy(s,_predicate->_pred);
+  if (_predicate) {
+    if (first) first = 0;
+    strcpy(s, "("); s += strlen(s);
+    strncpy(s, _predicate->_pred, buflen - strlen(s) - 1);
     s += strlen(s);
-    strcpy(s,")"); s += strlen(s);
+    strcpy(s, ")"); s += strlen(s);
   }
   for( DictI i(&names); i.test(); ++i ) {
     uintptr_t cnt = (uintptr_t)i._value;