diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 9035fbe24a..ff0ab7bc85 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -16,6 +16,14 @@ The license applies to all entries newer than 2009-04-28. */ +2012-01-31 00:56 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) + * harbour/contrib/gtwvg/wvgwin.c + ! added workaround for possible HVM string corruption and GPF in + WVG_SENDMESSAGE() function. This function is still very danger + when it's used with messages extracting data to passed buffer + and user have to pass string large enough to avoid possible + buffer overflow. + 2012-01-31 00:37 UTC+0100 Przemyslaw Czerpak (druzus/at/poczta.onet.pl) * harbour/contrib/gtwvg/wvgwin.c ! fixed wrongly used string handler instead of string pointer as diff --git a/harbour/contrib/gtwvg/wvgwin.c b/harbour/contrib/gtwvg/wvgwin.c index 8d6fc5f6fb..d7ebb0fd4c 100644 --- a/harbour/contrib/gtwvg/wvgwin.c +++ b/harbour/contrib/gtwvg/wvgwin.c @@ -125,7 +125,11 @@ static HINSTANCE wvg_hInstance( void ) HB_FUNC( WVG_SENDMESSAGE ) { void * hText = NULL; - LPTSTR lpText = HB_PARSTR( 4, &hText, NULL ); + HB_SIZE nLen = 0; + LPCTSTR lpText = HB_PARSTR( 4, &hText, &nLen ); + + if( lpText && HB_ISBYREF( 4 ) ) + lpText = HB_STRUNSHARE( &hText, lpText, nLen ); hb_retnl( ( HB_ULONG ) SendMessage( ( HWND ) ( HB_PTRDIFF ) hb_parnint( 1 ), ( UINT ) hb_parni( 2 ),