diff options
Diffstat (limited to 'connectivity/source/drivers/dbase/DTable.cxx')
-rw-r--r-- | connectivity/source/drivers/dbase/DTable.cxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/connectivity/source/drivers/dbase/DTable.cxx b/connectivity/source/drivers/dbase/DTable.cxx index ffd4eb2ab30f..f3c15904072e 100644 --- a/connectivity/source/drivers/dbase/DTable.cxx +++ b/connectivity/source/drivers/dbase/DTable.cxx @@ -773,10 +773,8 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool for (std::size_t i = 1; aIter != aEnd && nByteOffset <= m_nBufferSize && i < nCount;++aIter, i++) { // Lengths depending on data type: - sal_Int32 nLen = 0; - sal_Int32 nType = 0; - nLen = m_aPrecisions[i-1]; - nType = m_aTypes[i-1]; + sal_Int32 nLen = m_aPrecisions[i-1]; + sal_Int32 nType = m_aTypes[i-1]; switch(nType) { @@ -835,8 +833,13 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool else if ( DataType::TIMESTAMP == nType ) { sal_Int32 nDate = 0,nTime = 0; + if (nLen < 8) + { + SAL_WARN("connectivity.drivers", "short TIMESTAMP"); + return false; + } memcpy(&nDate, pData, 4); - memcpy(&nTime, pData+ 4, 4); + memcpy(&nTime, pData + 4, 4); if ( !nDate && !nTime ) { (_rRow->get())[i]->setNull(); @@ -914,7 +917,7 @@ bool ODbaseTable::fetchRow(OValueRefRow& _rRow, const OSQLColumns & _rCols, bool { case DataType::DATE: { - if (aStr.getLength() != nLen) + if (nLen < 8 || aStr.getLength() != nLen) { (_rRow->get())[i]->setNull(); break; |