* gnu/gcj/convert/natIconv.cc (init): Terminate buffer.

From-SVN: r36733
This commit is contained in:
Tom Tromey 2000-10-05 21:32:09 +00:00 committed by Tom Tromey
parent 61a77fea4a
commit cfa82f4d03
2 changed files with 8 additions and 2 deletions

View File

@ -1,3 +1,7 @@
2000-10-05 Tom Tromey <tromey@cygnus.com>
* gnu/gcj/convert/natIconv.cc (init): Terminate buffer.
2000-10-02 Bryce McKinlay <bryce@albatross.co.nz> 2000-10-02 Bryce McKinlay <bryce@albatross.co.nz>
* prims.cc (_Jv_argv, _Jv_argc): New fields. * prims.cc (_Jv_argv, _Jv_argc): New fields.

View File

@ -38,8 +38,9 @@ gnu::gcj::convert::Input_iconv::init (jstring encoding)
{ {
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
jsize len = _Jv_GetStringUTFLength (encoding); jsize len = _Jv_GetStringUTFLength (encoding);
char buffer[len]; char buffer[len + 1];
_Jv_GetStringUTFRegion (encoding, 0, len, buffer); _Jv_GetStringUTFRegion (encoding, 0, len, buffer);
buffer[len] = '\0';
iconv_t h = iconv_open ("UCS-2", buffer); iconv_t h = iconv_open ("UCS-2", buffer);
if (h == (iconv_t) -1) if (h == (iconv_t) -1)
@ -97,8 +98,9 @@ gnu::gcj::convert::Output_iconv::init (jstring encoding)
{ {
#ifdef HAVE_ICONV #ifdef HAVE_ICONV
jsize len = _Jv_GetStringUTFLength (encoding); jsize len = _Jv_GetStringUTFLength (encoding);
char buffer[len]; char buffer[len + 1];
_Jv_GetStringUTFRegion (encoding, 0, len, buffer); _Jv_GetStringUTFRegion (encoding, 0, len, buffer);
buffer[len] = '\0';
iconv_t h = iconv_open (buffer, "UCS-2"); iconv_t h = iconv_open (buffer, "UCS-2");
if (h == (iconv_t) -1) if (h == (iconv_t) -1)