Currently the maximal length for the "OutConnectionString" parameter of SQLDriverConnect() is 256. This is too little and can be easily overflowed, for example when using embedded Firebird database when the path to the database file is long enough (notice that it doesn't need to be nearly 256 chars long, there is a lot of other information in the DSN, e.g. ~64 characters of the encrypted password, information about the driver, ... -- in practice rather short paths already overflow this limit).
In fact MSDN description of this function (http://msdn.microsoft.com/en-us/library/ms715433(VS.85).aspx) even explicitly says "Applications should allocate at least 1,024 characters for this buffer.". And the following trivial patch does exactly this:
--- a/3rdparty/libodbcxx/src/connection.cpp
+++ b/3rdparty/libodbcxx/src/connection.cpp
@@ -217,7 +217,7 @@ void Connection::_connect(const ODBCXX_STRING& connectString,
SQLUSMALLINT drvcompl,
ODBCXX_STRING *connectStringFull)
{
- ODBCXX_CHAR_TYPE tmp[256];
+ ODBCXX_CHAR_TYPE tmp[1024];
SQLSMALLINT connectStringSize = 0;
SQLRETURN r=SQLDriverConnect(hdbc_,
#ifdef WIN32
@@ -230,7 +230,7 @@ void Connection::_connect(const ODBCXX_STRING& connectString,
(ODBCXX_SQLCHAR*) ODBCXX_STRING_DATA(connectString),
ODBCXX_STRING_LEN(connectString),
(ODBCXX_SQLCHAR*) tmp,
- 255,
+ sizeof(tmp)/sizeof(tmp[0]),
&connectStringSize,
drvcompl);
Notice that this patch is on top of the 2881067 one but it's so simple that it could be manually applied independently, of course.