Author: sebor
Date: Tue Apr 22 15:24:48 2008
New Revision: 650678

URL: http://svn.apache.org/viewvc?rev=650678&view=rev
Log:
2008-04-22  Martin Sebor  <[EMAIL PROTECTED]>

        STDCXX-753
        * util/charmap.cpp (Charmap::convert_to_ucs): Unconditionally
        allocated (8 + 1) bytes for the longest UTF-8 character rather
        than assuming that MB_LEN_MAX is large enough.

Modified:
    stdcxx/branches/4.2.x/util/charmap.cpp

Modified: stdcxx/branches/4.2.x/util/charmap.cpp
URL: 
http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/util/charmap.cpp?rev=650678&r1=650677&r2=650678&view=diff
==============================================================================
--- stdcxx/branches/4.2.x/util/charmap.cpp (original)
+++ stdcxx/branches/4.2.x/util/charmap.cpp Tue Apr 22 15:24:48 2008
@@ -22,7 +22,7 @@
  * implied.   See  the License  for  the  specific language  governing
  * permissions and limitations under the License.
  *
- * Copyright 2001-2007 Rogue Wave Software, Inc.
+ * Copyright 2001-2008 Rogue Wave Software, Inc.
  * 
  **************************************************************************/
 
@@ -671,7 +671,8 @@
         return true;
     }
 
-    char utf8_enc [_RWSTD_MB_LEN_MAX + 1];
+    // allocate enough space for the longest possible UTF-8 character
+    char utf8_enc [8 + 1 /* NUL */];
 
     const char* const ch_end =
         convert_to_utf8  (encoding.c_str (), encoding.size (),


Reply via email to