diff --git a/harbour/ChangeLog b/harbour/ChangeLog index d3061c4a62..d222a5cc20 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,19 @@ The license applies to all entries newer than 2009-04-28. */ +2011-01-26 19:08 UTC+0100 Przemyslaw Czerpak (druzus/at/priv.onet.pl) + * harbour/src/pp/hbpp.c + * modified syntax info to keep output well formatted for 80 columns + * harbour/src/pp/hbpp.1 + * updated + + * harbour/src/rdd/dbf1.c + * harbour/src/rdd/delim1.c + * harbour/src/rdd/sdf1.c + * harbour/contrib/rddsql/sqlbase.c + ! added protection against GPF when wrong field index is passed to + {GET|PUT}VALUE[FILE]() methods + 2011-01-26 18:06 UTC+0100 Viktor Szakats (harbour.01 syenar.hu) * contrib/hbnetio/utils/netiosrv/netiosrv.prg * contrib/hbnetio/utils/netiosrv/netiocmd.prg diff --git a/harbour/contrib/rddsql/sqlbase.c b/harbour/contrib/rddsql/sqlbase.c index f689b4f276..0c2166af79 100644 --- a/harbour/contrib/rddsql/sqlbase.c +++ b/harbour/contrib/rddsql/sqlbase.c @@ -462,6 +462,9 @@ static HB_ERRCODE sqlbaseDeleted( SQLBASEAREAP pArea, HB_BOOL* pDeleted ) static HB_ERRCODE sqlbaseGetValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pItem ) { + if( uiIndex == 0 || uiIndex > pArea->area.uiFieldCount ) + return HB_FAILURE; + if ( pArea->bRecordFlags & SQLDD_FLAG_CACHED ) { hb_arrayGet( ( PHB_ITEM ) pArea->pRecord, uiIndex, pItem ); @@ -527,6 +530,9 @@ static HB_ERRCODE sqlbasePutValue( SQLBASEAREAP pArea, HB_USHORT uiIndex, PHB_IT LPFIELD pField; HB_ERRCODE errCode; + if( uiIndex == 0 || uiIndex > pArea->area.uiFieldCount ) + return HB_FAILURE; + if ( ! pArea->fPositioned ) return HB_SUCCESS; diff --git a/harbour/src/pp/hbpp.1 b/harbour/src/pp/hbpp.1 index 8d5c74c579..5c4583f6f7 100644 --- a/harbour/src/pp/hbpp.1 +++ b/harbour/src/pp/hbpp.1 @@ -19,6 +19,8 @@ C source code with preprocesor rules defined in given files. .SH OPTIONS .IP "\fB\-d\fR\fI\fP[\fB=\fR\fI\fP]" 16 #define \fR\fI\fP +.IP "\fB-e\fP[\fR\fI\fP]" 16 +use \fR\fI\fP as entry function in generated .c PP rules .IP "\fB-i\fR\fI\fP" 16 add #include file search path .IP "\fB-u\fP[\fR\fI\fP]" 16 diff --git a/harbour/src/pp/hbpp.c b/harbour/src/pp/hbpp.c index 39a6566b19..9012d6d321 100644 --- a/harbour/src/pp/hbpp.c +++ b/harbour/src/pp/hbpp.c @@ -636,7 +636,7 @@ static void hb_pp_usage( char * szName ) printf( "\n" ); printf( "Syntax: %s [options]\n\n", szName ); printf( "Options: -d[=]\t#define \n" - " -e[] \tuse as entry function in generated .c PP rules\n" + " -e[] \tuse as entry function in generated .c\n" " -i \tadd #include file search path\n" " -u[] \tuse command def set in (or none)\n" " -c[] \tlook for ChangeLog file\n" diff --git a/harbour/src/rdd/dbf1.c b/harbour/src/rdd/dbf1.c index 26a7f493af..d5899d052c 100644 --- a/harbour/src/rdd/dbf1.c +++ b/harbour/src/rdd/dbf1.c @@ -1827,8 +1827,10 @@ static HB_ERRCODE hb_dbfGetValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI if( !pArea->fValidBuffer && !hb_dbfReadRecord( pArea ) ) return HB_FAILURE; + if( --uiIndex >= pArea->area.uiFieldCount ) + return HB_FAILURE; + fError = HB_FALSE; - uiIndex--; pField = pArea->area.lpFields + uiIndex; switch( pField->uiType ) { @@ -2260,6 +2262,9 @@ static HB_ERRCODE hb_dbfPutValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI if( !pArea->fValidBuffer && !hb_dbfReadRecord( pArea ) ) return HB_FAILURE; + if( --uiIndex >= pArea->area.uiFieldCount ) + return HB_FAILURE; + if( !pArea->fPositioned ) return HB_SUCCESS; @@ -2268,7 +2273,6 @@ static HB_ERRCODE hb_dbfPutValue( DBFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI return HB_FAILURE; errCode = HB_SUCCESS; - uiIndex--; pField = pArea->area.lpFields + uiIndex; if( pField->uiType == HB_FT_MEMO || pField->uiType == HB_FT_IMAGE || diff --git a/harbour/src/rdd/delim1.c b/harbour/src/rdd/delim1.c index ea359b6dbb..c5b3785a83 100644 --- a/harbour/src/rdd/delim1.c +++ b/harbour/src/rdd/delim1.c @@ -550,7 +550,9 @@ static HB_ERRCODE hb_delimGetValue( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITE HB_TRACE(HB_TR_DEBUG, ("hb_delimGetValue(%p, %hu, %p)", pArea, uiIndex, pItem)); - --uiIndex; + if( --uiIndex >= pArea->area.uiFieldCount ) + return HB_FAILURE; + pField = pArea->area.lpFields + uiIndex; switch( pField->uiType ) { @@ -651,8 +653,10 @@ static HB_ERRCODE hb_delimPutValue( DELIMAREAP pArea, HB_USHORT uiIndex, PHB_ITE if( !pArea->fRecordChanged ) return HB_FAILURE; + if( --uiIndex >= pArea->area.uiFieldCount ) + return HB_FAILURE; + errCode = HB_SUCCESS; - --uiIndex; pField = pArea->area.lpFields + uiIndex; if( pField->uiType != HB_FT_MEMO && pField->uiType != HB_FT_NONE ) { diff --git a/harbour/src/rdd/sdf1.c b/harbour/src/rdd/sdf1.c index 810500bff0..814c0c3f0e 100644 --- a/harbour/src/rdd/sdf1.c +++ b/harbour/src/rdd/sdf1.c @@ -375,7 +375,9 @@ static HB_ERRCODE hb_sdfGetValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI HB_TRACE(HB_TR_DEBUG, ("hb_sdfGetValue(%p, %hu, %p)", pArea, uiIndex, pItem)); - --uiIndex; + if( --uiIndex >= pArea->area.uiFieldCount ) + return HB_FAILURE; + pField = pArea->area.lpFields + uiIndex; switch( pField->uiType ) { @@ -482,8 +484,10 @@ static HB_ERRCODE hb_sdfPutValue( SDFAREAP pArea, HB_USHORT uiIndex, PHB_ITEM pI if( !pArea->fRecordChanged ) return HB_FAILURE; + if( --uiIndex >= pArea->area.uiFieldCount ) + return HB_FAILURE; + errCode = HB_SUCCESS; - --uiIndex; pField = pArea->area.lpFields + uiIndex; if( pField->uiType != HB_FT_MEMO && pField->uiType != HB_FT_NONE ) {