2008-10-26 22:25 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* source/common/hbfopen.c
* Changed hb_fopen() to use fopen_s(), secure version of
fopen() for MSVS 2005 and upper.
* source/common/hbstr.c
+ Added hb_snprintf() Harbour wrapper for snprintf() which
terminates the buffer with a '\0' char for CRTLs that
need this (like MSVC).
MSVC _snprintf() doesn't do so.
* hb_snprintf() used _snprintf_s(), secure version of
_snprintf() for MSVS 2005 and upper.
; TOFIX: There is still one strcpy() marked as non-secure
in debug lib. Could someone please take a look
at it and replace it with hb_strncpy() or something
else secure? The code is cryptic and as someone
not using the debugger, I didn't dare to touch it,
and this is the only one such call left.
; TODO: Change all snprintf() calls to hb_snprintf().
When that happens, Harbour will no more use anything
depicted as "non-secure" by MSVS 2005/2008.
; NOTE: This function may need tweaking, pls review and
fix if/where needed.
* source/vm/dlmalloc.c
! Fixed MSVC C++ mode compile error. This fix also exists
as part of the next dlmalloc version (2.8.4b).
2008-10-26 07:27 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
* contrib/hbdbgfx/dbgfx.prg
* Minor cleanup.
* contrib/hbdbgfx/dbgfxc.c
! Fixed GPF when non-string parameter passed to
hb_outdebug().
This commit is contained in:
@@ -8,6 +8,34 @@
|
||||
2008-12-31 13:59 UTC+0100 Foo Bar (foo.bar foobar.org)
|
||||
*/
|
||||
|
||||
2008-10-26 22:25 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* source/common/hbfopen.c
|
||||
* Changed hb_fopen() to use fopen_s(), secure version of
|
||||
fopen() for MSVS 2005 and upper.
|
||||
|
||||
* source/common/hbstr.c
|
||||
+ Added hb_snprintf() Harbour wrapper for snprintf() which
|
||||
terminates the buffer with a '\0' char for CRTLs that
|
||||
need this (like MSVC).
|
||||
MSVC _snprintf() doesn't do so.
|
||||
* hb_snprintf() used _snprintf_s(), secure version of
|
||||
_snprintf() for MSVS 2005 and upper.
|
||||
; TOFIX: There is still one strcpy() marked as non-secure
|
||||
in debug lib. Could someone please take a look
|
||||
at it and replace it with hb_strncpy() or something
|
||||
else secure? The code is cryptic and as someone
|
||||
not using the debugger, I didn't dare to touch it,
|
||||
and this is the only one such call left.
|
||||
; TODO: Change all snprintf() calls to hb_snprintf().
|
||||
When that happens, Harbour will no more use anything
|
||||
depicted as "non-secure" by MSVS 2005/2008.
|
||||
; NOTE: This function may need tweaking, pls review and
|
||||
fix if/where needed.
|
||||
|
||||
* source/vm/dlmalloc.c
|
||||
! Fixed MSVC C++ mode compile error. This fix also exists
|
||||
as part of the next dlmalloc version (2.8.4b).
|
||||
|
||||
2008-10-26 07:27 UTC+0200 Viktor Szakats (harbour.01 syenar hu)
|
||||
* contrib/hbdbgfx/dbgfx.prg
|
||||
* Minor cleanup.
|
||||
|
||||
@@ -56,7 +56,14 @@ FILE * hb_fopen( const char *path, const char *mode )
|
||||
{
|
||||
BOOL fFree;
|
||||
char * pszFile = ( char * ) hb_fsNameConv( ( BYTE * ) path, &fFree );
|
||||
FILE * file = fopen( pszFile, mode );
|
||||
FILE * file;
|
||||
|
||||
#if defined( _MSC_VER ) && _MSC_VER >= 1400
|
||||
file = NULL;
|
||||
fopen_s( &file, pszFile, mode );
|
||||
#else
|
||||
file = fopen( pszFile, mode );
|
||||
#endif
|
||||
|
||||
if( fFree )
|
||||
hb_xfree( pszFile );
|
||||
|
||||
@@ -1108,3 +1108,35 @@ char * hb_compDecodeString( int iMethod, const char * szText, ULONG * pulLen )
|
||||
}
|
||||
return pBuffer;
|
||||
}
|
||||
|
||||
#undef _HB_SNPRINTF_ADD_EOS
|
||||
#undef snprintf
|
||||
/* NOTE: The full size of the buffer is expected as nSize. [vszakats] */
|
||||
HB_EXPORT void hb_snprintf( char * buffer, ULONG nSize, ... )
|
||||
{
|
||||
va_list va;
|
||||
|
||||
va_start( va, nSize );
|
||||
|
||||
#if defined( __DJGPP__ ) && ( __DJGPP__ < 2 || ( __DJGPP__ == 2 && __DJGPP_MINOR__ <= 3 ) )
|
||||
/* Use sprintf() for DJGPP <= 2.03.
|
||||
This is a temporary hack, should implement a C99 snprintf() ourselves. */
|
||||
sprintf( buffer, va );
|
||||
#elif defined( _MSC_VER ) && _MSC_VER >= 1400
|
||||
_snprintf_s( buffer, nSize, _TRUNCATE, va );
|
||||
#elif defined( _MSC_VER ) || defined( __DMC__ ) && !defined( __XCC__ )
|
||||
_snprintf( buffer, nSize, va );
|
||||
#define _HB_SNPRINTF_ADD_EOS
|
||||
#elif defined( __WATCOMC__ ) && __WATCOMC__ < 1200
|
||||
_bprintf( buffer, nSize, va );
|
||||
#else
|
||||
snprintf( buffer, nSize, va );
|
||||
#endif
|
||||
|
||||
va_end( va );
|
||||
|
||||
#ifdef _HB_SNPRINTF_ADD_EOS
|
||||
if( buffer && nSize )
|
||||
buffer[ nSize - 1 ] = '\0';
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1329,7 +1329,7 @@ static void* win32direct_mmap(size_t size) {
|
||||
/* This function supports releasing coalesed segments */
|
||||
static int win32munmap(void* ptr, size_t size) {
|
||||
MEMORY_BASIC_INFORMATION minfo;
|
||||
char* cptr = ptr;
|
||||
char* cptr = (char*)ptr; /* NOTE: Harbour fix for MSVC C++ mode compile error. Also fixed in dlmalloc 2.8.4b. [vszakats] */
|
||||
while (size) {
|
||||
if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0)
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user