diff options
-rw-r--r-- | connectivity/source/drivers/odbcbase/OTools.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/connectivity/source/drivers/odbcbase/OTools.cxx b/connectivity/source/drivers/odbcbase/OTools.cxx index 290aa611d015..fbeeec65fd37 100644 --- a/connectivity/source/drivers/odbcbase/OTools.cxx +++ b/connectivity/source/drivers/odbcbase/OTools.cxx @@ -447,6 +447,8 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection, return ::rtl::OUString(); SQLLEN nReadChars; + OSL_ENSURE( (pcbValue < 0) || (pcbValue % 2 == 0), + "ODBC: SQLGetData of SQL_C_WCHAR returned odd number of bytes"); if ( (pcbValue == SQL_NO_TOTAL) || (pcbValue >= nMaxLen) ) { // we filled the buffer; remove the terminating null character @@ -459,7 +461,7 @@ Sequence<sal_Int8> OTools::getBytesValue(const OConnection* _pConnection, } else { - nReadChars = pcbValue; + nReadChars = pcbValue/sizeof(sal_Unicode); } aData.append(waCharArray, nReadChars); |