diff --git a/libjava/ChangeLog b/libjava/ChangeLog index 80185b844fb..d568149475e 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -1,3 +1,7 @@ +2000-10-05 Tom Tromey + + * gnu/gcj/convert/natIconv.cc (init): Terminate buffer. + 2000-10-02 Bryce McKinlay * prims.cc (_Jv_argv, _Jv_argc): New fields. diff --git a/libjava/gnu/gcj/convert/natIconv.cc b/libjava/gnu/gcj/convert/natIconv.cc index fe79dc12515..061779c02b8 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)