From 4ae51516c204cf90c2e0534ba9bbf656d908e25e Mon Sep 17 00:00:00 2001 From: mdlugosz65 Date: Mon, 28 Oct 2024 16:57:47 +0100 Subject: [PATCH] 2024-10-28 16:57 UTC+0100 Aleksander Czajczynski (hb fki.pl) * src/rdd/dbf1.c ! reading varchar binary field ("Q:B") from a .dbf could free a wrong pointer in the record buffer. Bug located and fixed by Marek. --- ChangeLog.txt | 6 ++++++ src/rdd/dbf1.c | 10 ++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 8ffc60ffda..802c1e059d 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -7,6 +7,12 @@ Entries may not always be in chronological/commit order. See license at the end of file. */ +2024-10-28 16:57 UTC+0100 Aleksander Czajczynski (hb fki.pl) + * src/rdd/dbf1.c + ! reading varchar binary field ("Q:B") from a .dbf + could free a wrong pointer in the record buffer. + Bug located and fixed by Marek. + 2024-10-25 14:09 UTC+0200 Aleksander Czajczynski (hb fki.pl) * contrib/hbziparc/ziparc.prg ! return value of hb_zipDeleteFile() is not logical, diff --git a/src/rdd/dbf1.c b/src/rdd/dbf1.c index 0c2d3dd0a8..b6d4335f71 100644 --- a/src/rdd/dbf1.c +++ b/src/rdd/dbf1.c @@ -2193,12 +2193,14 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI nLen = pField->uiLen; } if( ( pField->uiFlags & HB_FF_BINARY ) == 0 ) + { pszVal = hb_cdpnDup( ( const char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ], &nLen, pArea->area.cdPage, hb_vmCDP() ); - else - pszVal = ( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ]; - - hb_itemPutCLPtr( pItem, pszVal, nLen ); + hb_itemPutCLPtr( pItem, pszVal, nLen ); + break; + } + pszVal = ( char * ) pArea->pRecord + pArea->pFieldOffset[ uiIndex ]; + hb_itemPutCL( pItem, pszVal, nLen ); } break;