diff options
author | Tom Tromey <tromey@cygnus.com> | 2000-10-05 21:32:09 +0000 |
---|---|---|
committer | Tom Tromey <tromey@gcc.gnu.org> | 2000-10-05 21:32:09 +0000 |
commit | cfa82f4d034b0905dbdbe321d606a374065c6d43 (patch) | |
tree | 0e75e88b2abe83308c5b43aa2f6b201ae3a4e63c /libjava/gnu | |
parent | 61a77fea4a8fd6dec08a11fc26574c146a7903e5 (diff) | |
download | gcc-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.cc | 6 |
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) |