FirebirdSQL/firebird-odbc-driver

internal Buffer of ConvertingString not initialised [ODBC157]

firebird-automations opened this issue · 3 comments

Submitted by: Gerhard Kokerbeck (gerd)

ConvertingString ueses an internal Buffer, aloccated with new, leaving it uninitialised.
If the Buffer is not used the automatic conversion that is done in the dtor of ConvertingString may give unpredictable errors.
Heres a patch to fix this:

--- g:\zw\OdbcFb-Source-2.0.1.152\MainUnicode.cpp 2011-10-11 15:12:18.000000000 +0100
+++ f:\src\odbcfb_src\MainUnicode.cpp 2012-12-13 14:31:16.000000000 +0100
@@ -215,13 +215,16 @@
void Alloc()
{
switch ( isWhy )
{
case BYTESCHARS:
if ( lengthString )
+ {
byteString = new SQLCHAR[ lengthString + 2 ];
+ memset(byteString,0,lengthString+2);
+ }
else
byteString = NULL;
break;

	case NONE:
		unicodeString = NULL;

Commits: b54f88f c775bf2

Commented by: @alexpotapchenko

Fixed in CVS, thanks

Modified by: @alexpotapchenko

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

Fix Version: 2.0.2 [ 10465 ]

Modified by: @alexpotapchenko

status: Resolved [ 5 ] => Closed [ 6 ]