Skip to content

Commit

Permalink
Fix for ODBC-179. For the SQLxxxW family of functions the Wide To Mbs…
Browse files Browse the repository at this point in the history
… conversion forwards the maximum required buffer size instead of the actual length/needed bytes of the converted input string
  • Loading branch information
alexpotapchenko committed Jul 5, 2016
1 parent 8de04c8 commit eb3f397
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MainUnicode.cpp
Expand Up @@ -192,13 +192,13 @@ class ConvertingString
byteString = new SQLCHAR[ bytesNeeded + 2 ];

if ( connection )
connection->WcsToMbs( (char *)byteString, (const wchar_t*)wcString, bytesNeeded );
bytesNeeded = connection->WcsToMbs( (char *)byteString, (const wchar_t*)wcString, bytesNeeded );
else
{
#ifdef _WINDOWS
WideCharToMultiByte( codePage, 0, wcString, length, (LPSTR)byteString, (int)bytesNeeded, NULL, NULL );
bytesNeeded = WideCharToMultiByte( codePage, 0, wcString, length, (LPSTR)byteString, (int)bytesNeeded, NULL, NULL );
#else
wcstombs( (char *)byteString, (const wchar_t*)wcString, bytesNeeded );
bytesNeeded = wcstombs( (char *)byteString, (const wchar_t*)wcString, bytesNeeded );
#endif
}

Expand Down

0 comments on commit eb3f397

Please sign in to comment.