2008-08-25 20:14 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
* harbour/contrib/hbw32/w32_ole.c
* removed hack with malloc()/free() directly used to avoid
memory leak reports - it's not necessary in Harbour.
* harbour/contrib/hbfbird/firebird.c
* harbour/contrib/examples/pp/hbppcore.c
! fixed buffer size calculation in hbstrnc*() functions
* harbour/contrib/hbziparch/hbzipnew.cpp
% use hb_strdup() instead of hb_xgrab()/hb_strncpy()
* harbour/contrib/hbnf/getenvrn.c
! use hb_xgrab() instead of hb_xalloc() - the returned value
was not checked and internal error is for sure better then
GPF on NULL pointer
* harbour/source/rdd/dbfntx/dbfntx1.c
! use memcpy() instead of hb_strncpy() to avoid problems when
there is no place for tailing 0
This commit is contained in:
@@ -8,6 +8,27 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2008-08-25 20:14 UTC+0200 Przemyslaw Czerpak (druzus/at/priv.onet.pl)
|
||||
* harbour/contrib/hbw32/w32_ole.c
|
||||
* removed hack with malloc()/free() directly used to avoid
|
||||
memory leak reports - it's not necessary in Harbour.
|
||||
|
||||
* harbour/contrib/hbfbird/firebird.c
|
||||
* harbour/contrib/examples/pp/hbppcore.c
|
||||
! fixed buffer size calculation in hbstrnc*() functions
|
||||
|
||||
* harbour/contrib/hbziparch/hbzipnew.cpp
|
||||
% use hb_strdup() instead of hb_xgrab()/hb_strncpy()
|
||||
|
||||
* harbour/contrib/hbnf/getenvrn.c
|
||||
! use hb_xgrab() instead of hb_xalloc() - the returned value
|
||||
was not checked and internal error is for sure better then
|
||||
GPF on NULL pointer
|
||||
|
||||
* harbour/source/rdd/dbfntx/dbfntx1.c
|
||||
! use memcpy() instead of hb_strncpy() to avoid problems when
|
||||
there is no place for tailing 0
|
||||
|
||||
2008-08-25 19:49 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* include/hbsetup.h
|
||||
! Fixed problem where Darwin autodetection went wrong
|
||||
|
||||
@@ -2178,7 +2178,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL
|
||||
|
||||
maxlenreal = HB_PP_STR_SIZE;
|
||||
if( s_expreal == NULL )
|
||||
s_expreal = ( char * ) hb_xgrab( maxlenreal );
|
||||
s_expreal = ( char * ) hb_xgrab( maxlenreal + 1 );
|
||||
|
||||
/* Copying a match pattern to 'exppatt' */
|
||||
lenpatt = stroncpy( exppatt, *ptrmp, 4 );
|
||||
@@ -2376,7 +2376,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL
|
||||
if( ! com_or_tra )
|
||||
{
|
||||
/* translate */
|
||||
hb_strncpy( s_expreal + 1, *ptri, lenreal );
|
||||
hb_strncpy( s_expreal + 1, *ptri, HB_PP_STR_SIZE - 1 );
|
||||
s_expreal[0] = '&';
|
||||
s_expreal[lenreal + 1] = '\0';
|
||||
*ptri += lenreal;
|
||||
@@ -2406,7 +2406,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL
|
||||
* is preprocessed into:
|
||||
* &a ++( b )
|
||||
*/
|
||||
hb_strncpy( s_expreal + 1, *ptri, lenreal );
|
||||
hb_strncpy( s_expreal + 1, *ptri, HB_PP_STR_SIZE - 1 );
|
||||
s_expreal[0] = '&';
|
||||
s_expreal[lenreal + 1] = '\0';
|
||||
*ptri += lenreal;
|
||||
|
||||
@@ -117,11 +117,15 @@ HB_FUNC( FBCONNECT )
|
||||
dpb[ i++ ] = isc_dpb_version1;
|
||||
dpb[ i++ ] = isc_dpb_user_name;
|
||||
len = strlen( user );
|
||||
if( len > ( int ) ( sizeof( dpb ) - i - 4 ) )
|
||||
len = ( int ) ( sizeof( dpb ) - i - 4 );
|
||||
dpb[ i++ ] = ( char ) len;
|
||||
hb_strncpy( &( dpb[ i ] ), user, len );
|
||||
i += len;
|
||||
dpb[ i++ ] = isc_dpb_password;
|
||||
len = strlen( passwd );
|
||||
if( len > ( int ) ( sizeof( dpb ) - i - 2 ) )
|
||||
len = ( int ) ( sizeof( dpb ) - i - 2 );
|
||||
dpb[ i++ ] = len;
|
||||
hb_strncpy( &( dpb[ i ] ), passwd, len );
|
||||
i += len;
|
||||
|
||||
@@ -151,7 +151,7 @@ HB_FUNC( FT_GETE )
|
||||
/* add 1 more byte for final nul character */
|
||||
buffsize++;
|
||||
/* now allocate that much memory and make sure 1st byte is a nul */
|
||||
buffer = ( char * ) hb_xalloc( buffsize + 1 );
|
||||
buffer = ( char * ) hb_xgrab( buffsize + 1 );
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ HB_FUNC( FT_GETE )
|
||||
buffsize++;
|
||||
|
||||
/* now allocate that much memory and make sure 1st byte is a nul */
|
||||
buffer = ( char * ) hb_xalloc( buffsize + 1 );
|
||||
buffer = ( char * ) hb_xgrab( buffsize + 1 );
|
||||
buffer[0] = '\0';
|
||||
}
|
||||
x = 0;
|
||||
|
||||
@@ -1605,6 +1605,7 @@ static void OleThrowError( void )
|
||||
{
|
||||
PHB_ITEM pReturn;
|
||||
char *sDescription;
|
||||
BOOL fFree = FALSE;
|
||||
|
||||
hb_vmPushSymbol( hb_dynsymSymbol( s_pSym_cClassName ) );
|
||||
hb_vmPush( hb_stackSelfItem() );
|
||||
@@ -1612,11 +1613,8 @@ static void OleThrowError( void )
|
||||
|
||||
if( s_nOleError == DISP_E_EXCEPTION )
|
||||
{
|
||||
// Intentional to avoid report of memory leak if fatal error.
|
||||
char * sTemp = hb_oleWideToAnsi( excep.bstrDescription );
|
||||
sDescription = ( char * ) malloc( strlen( sTemp ) + 1 );
|
||||
hb_strncpy( sDescription, sTemp, strlen( sTemp ) );
|
||||
hb_xfree( sTemp );
|
||||
sDescription = hb_oleWideToAnsi( excep.bstrDescription );
|
||||
fFree = TRUE;
|
||||
}
|
||||
else
|
||||
sDescription = Ole2TxtError();
|
||||
@@ -1625,9 +1623,9 @@ static void OleThrowError( void )
|
||||
|
||||
pReturn = hb_errRT_SubstParams( hb_parcx( -1 ), EG_OLEEXECPTION, (ULONG) s_nOleError, sDescription, hb_itemGetSymbol( hb_stackBaseItem() )->szName );
|
||||
|
||||
if( s_nOleError == DISP_E_EXCEPTION )
|
||||
if( fFree )
|
||||
{
|
||||
free( ( void * ) sDescription );
|
||||
hb_xfree( ( void * ) sDescription );
|
||||
}
|
||||
|
||||
if( pReturn )
|
||||
|
||||
@@ -875,8 +875,7 @@ const char * hb_GetZipComment( char * szFile )
|
||||
else
|
||||
szReturn = "";
|
||||
|
||||
szTempR = ( char * ) hb_xgrab( strlen( ( const char * ) szReturn ) + 1 );
|
||||
hb_strncpy( szTempR, ( char * ) szReturn, strlen( ( const char * ) szReturn ) );
|
||||
szTempR = hb_strdup( szReturn );
|
||||
|
||||
szZip.Close();
|
||||
|
||||
|
||||
@@ -1588,7 +1588,7 @@ static LPTAGINFO hb_ntxTagLoad( LPNTXINDEX pIndex, ULONG ulBlock,
|
||||
static void hb_ntxIndexTagAdd( LPNTXINDEX pIndex, LPTAGINFO pTag )
|
||||
{
|
||||
LPCTXHEADER lpCTX = ( LPCTXHEADER ) pIndex->HeaderBuff;
|
||||
int iTags = HB_GET_LE_UINT16( lpCTX->ntags ), i;
|
||||
int iTags = HB_GET_LE_UINT16( lpCTX->ntags ), iLen, i;
|
||||
LPCTXTAGITEM pTagItem = ( LPCTXTAGITEM ) lpCTX->tags;
|
||||
|
||||
for( i = 0; i < iTags; pTagItem++, i++ )
|
||||
@@ -1600,7 +1600,11 @@ static void hb_ntxIndexTagAdd( LPNTXINDEX pIndex, LPTAGINFO pTag )
|
||||
{
|
||||
++iTags;
|
||||
HB_PUT_LE_UINT16( lpCTX->ntags, iTags );
|
||||
hb_strncpy( ( char * ) pTagItem->tag_name, pTag->TagName, NTX_MAX_TAGNAME );
|
||||
iLen = ( int ) strlen( pTag->TagName );
|
||||
if( iLen > NTX_MAX_TAGNAME )
|
||||
iLen = NTX_MAX_TAGNAME;
|
||||
memcpy( pTagItem->tag_name, pTag->TagName, iLen );
|
||||
memset( pTagItem->tag_name + iLen, 0, sizeof( pTagItem->tag_name ) - iLen );
|
||||
}
|
||||
HB_PUT_LE_UINT32( pTagItem->tag_header, pTag->HeadBlock );
|
||||
pIndex->Update = TRUE;
|
||||
@@ -1652,7 +1656,7 @@ static ERRCODE hb_ntxTagHeaderSave( LPTAGINFO pTag )
|
||||
{
|
||||
LPNTXINDEX pIndex = pTag->Owner;
|
||||
NTXHEADER Header;
|
||||
int iSize = 12, type, version = 0;
|
||||
int iSize = 12, type, version = 0, iLen;
|
||||
ULONG next = 0;
|
||||
|
||||
if( pIndex->Compound )
|
||||
@@ -1708,11 +1712,24 @@ static ERRCODE hb_ntxTagHeaderSave( LPTAGINFO pTag )
|
||||
Header.unique[0] = pTag->UniqueKey ? 1 : 0;
|
||||
Header.descend[0] = pTag->AscendKey ? 0 : 1;
|
||||
Header.custom[0] = pTag->Custom ? 1 : 0;
|
||||
hb_strncpy( ( char * ) Header.key_expr, pTag->KeyExpr, NTX_MAX_EXP );
|
||||
iLen = ( int ) strlen( pTag->KeyExpr );
|
||||
if( iLen > NTX_MAX_EXP )
|
||||
iLen = NTX_MAX_EXP;
|
||||
memcpy( Header.key_expr, pTag->KeyExpr, iLen );
|
||||
if( pTag->ForExpr )
|
||||
hb_strncpy( ( char * ) Header.for_expr, pTag->ForExpr, NTX_MAX_EXP );
|
||||
{
|
||||
iLen = ( int ) strlen( pTag->ForExpr );
|
||||
if( iLen > NTX_MAX_EXP )
|
||||
iLen = NTX_MAX_EXP;
|
||||
memcpy( Header.for_expr, pTag->ForExpr, iLen );
|
||||
}
|
||||
if( pTag->fTagName )
|
||||
hb_strncpy( ( char * ) Header.tag_name, pTag->TagName, NTX_MAX_TAGNAME );
|
||||
{
|
||||
iLen = ( int ) strlen( pTag->TagName );
|
||||
if( iLen > NTX_MAX_TAGNAME )
|
||||
iLen = NTX_MAX_TAGNAME;
|
||||
memcpy( Header.tag_name, pTag->TagName, iLen );
|
||||
}
|
||||
iSize = sizeof( NTXHEADER );
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user