aboutsummaryrefslogtreecommitdiff
path: root/libjava
diff options
context:
space:
mode:
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog5
-rw-r--r--libjava/java/lang/natString.cc4
2 files changed, 7 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog
index 027819a..daba9ef 100644
--- a/libjava/ChangeLog
+++ b/libjava/ChangeLog
@@ -1,3 +1,8 @@
+1999-04-21 Tom Tromey <tromey@cygnus.com>
+
+ * java/lang/natString.cc (getBytes): Correctly size result
+ buffer. From Bryce McKinlay <bryce@albatross.co.nz>.
+
1999-04-20 Andrew Haley <aph@cygnus.com>
* include/sparc-signal.h: new file.
diff --git a/libjava/java/lang/natString.cc b/libjava/java/lang/natString.cc
index a598485..cbd36bb 100644
--- a/libjava/java/lang/natString.cc
+++ b/libjava/java/lang/natString.cc
@@ -487,8 +487,8 @@ java::lang::String::getBytes (jstring enc)
}
if (bufpos == buflen)
return buffer;
- jbyteArray result = JvNewByteArray(bufpos);
- memcpy (elements (result), elements (buffer), bufpos);
+ jbyteArray result = JvNewByteArray(buflen);
+ memcpy (elements (result), elements (buffer), buflen);
return result;
}