Hi,

> This warning is generated for hbpgsql library:
> 
> ../../../postgres.c: In function ‘HB_FUN_PQESCAPEBYTEA’:
> ../../../postgres.c:816: warning: dereferencing type-punned pointer will 
> break strict-aliasing rules
> 
> This is real bug and definitely has to be fixed, it passes pointer
> to HB_SIZE casted to pointer to size_t. On platforms like Win64 it's
> buffer overflow bug.
> Can someone familiar with this code fix it?
> i.e. it may looks like:
> 
> HB_FUNC( PQESCAPEBYTEA ) /* deprecated */
> {
>   size_t from_length = ( size_t ) hb_parclen( 1 );
>   size_t to_length = from_length * 5 + 1;
>   unsigned char * to = PQescapeBytea( ( const unsigned char * ) hb_parcx( 1 ),
>                                         from_length, &to_length );
>   hb_retclen( ( char * ) to, to_length );
>   PQfreemem( to );
> }

Pls just delete this function, the low-level API 
is deprecated (I assume since long years), so it's 
not worth to spend much time on it, and maybe it 
cannot even be fixed since the API may just be 
wrongly designed.

Brgds,
Viktor

_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
[email protected]
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to