aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu
diff options
context:
space:
mode:
authorTom Tromey <tromey@cygnus.com>2000-10-05 21:32:09 +0000
committerTom Tromey <tromey@gcc.gnu.org>2000-10-05 21:32:09 +0000
commitcfa82f4d034b0905dbdbe321d606a374065c6d43 (patch)
tree0e75e88b2abe83308c5b43aa2f6b201ae3a4e63c /libjava/gnu
parent61a77fea4a8fd6dec08a11fc26574c146a7903e5 (diff)
downloadgcc-cfa82f4d034b0905dbdbe321d606a374065c6d43.zip
gcc-cfa82f4d034b0905dbdbe321d606a374065c6d43.tar.gz
gcc-cfa82f4d034b0905dbdbe321d606a374065c6d43.tar.bz2
* gnu/gcj/convert/natIconv.cc (init): Terminate buffer.
From-SVN: r36733
Diffstat (limited to 'libjava/gnu')
-rw-r--r--libjava/gnu/gcj/convert/natIconv.cc6
1 files changed, 4 insertions, 2 deletions
diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc
index fe79dc1..061779c 100644
--- a/libjava/gnu/gcj/convert/natIconv.cc
+++ b/libjava/gnu/gcj/convert/natIconv.cc
@@ -38,8 +38,9 @@ gnu::gcj::convert::Input_iconv::init (jstring encoding)
{
#ifdef HAVE_ICONV
jsize len = _Jv_GetStringUTFLength (encoding);
- char buffer[len];
+ char buffer[len + 1];
_Jv_GetStringUTFRegion (encoding, 0, len, buffer);
+ buffer[len] = '\0';
iconv_t h = iconv_open ("UCS-2", buffer);
if (h == (iconv_t) -1)
@@ -97,8 +98,9 @@ gnu::gcj::convert::Output_iconv::init (jstring encoding)
{
#ifdef HAVE_ICONV
jsize len = _Jv_GetStringUTFLength (encoding);
- char buffer[len];
+ char buffer[len + 1];
_Jv_GetStringUTFRegion (encoding, 0, len, buffer);
+ buffer[len] = '\0';
iconv_t h = iconv_open (buffer, "UCS-2");
if (h == (iconv_t) -1)