On Thu, 23 Jul 2009, vszak...@users.sourceforge.net wrote:
> 2009-07-23 20:18 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
>   * contrib/rddads/ads1.c
>     ! Fixed buffer size in one place related to MEMO field handling.
>       Caused memory corruption.

Viktor, the code was correct and you've just added one unnecessary byte
in allocation.
Please revert it and if possible add additional error checking, i.e.:

      u32Len++;   /* make room for NULL */
      pucBuf = ( UNSIGNED8 * ) hb_xgrab( u32Len );
      ulRetVal = AdsGetBinary( pArea->hTable, ADSFIELD( uiIndex ), 0, pucBuf, 
&u32Len );
      if( ulRetVal != AE_SUCCESS )
      {
         hb_xfree( pucBuf );
         hb_itemPutC( pItem, NULL );
      }
      else
         hb_itemPutCLPtr( pItem, ( char * ) pucBuf, u32Len );

best regards,
Przemek
_______________________________________________
Harbour mailing list
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to