Correct two bugs in wxMBConv::FromWChar() with non NUL-terminated strings.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Dec 2009 02:30:05 +0000 (02:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 6 Dec 2009 02:30:05 +0000 (02:30 +0000)
commit2730723380b41dd1020e19cee33adfa993e2940c
tree211743212ae3d7141d6db2bbb1e3871525d4a269
parent961326054fcf39eaa56137aa034d4614ead64dd2
Correct two bugs in wxMBConv::FromWChar() with non NUL-terminated strings.

The variable "lenChunk" was incorrectly used as the length of the wide string
chunk which could result in wrong output.

Worse, the output buffer could be overflown for the final chunk because it
didn't have to have enough space for the trailing NUL(s) in it.

Fix both bugs and added unit tests for them.

Based on patch by Kuang-che Wu.

Closes #11486.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@62793 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
src/common/strconv.cpp
tests/mbconv/mbconvtest.cpp
tests/test_vc9_test.vcproj