2009-07-23 18:19 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)

+ source/rtl/hbfeof.c
  * source/rtl/Makefile
  * source/rtl/philes.c
    ! HB_FEOF() moved to separate file to ease name collision
      situations.

  * contrib/hbssl/evpciph.c
  * contrib/hbssl/bio.c
  * contrib/hbssl/evpmd.c
  * contrib/hbssl/evpenc.c
    ! Fixed buffer sizes, after valgrind test.
      (off by one bugs. hb_storclen_buffer()/hb_retclen_buffer() need
      one byte extra above the size returned, in order to hold the 
      EOS char)

  * contrib/xhb/freadlin.c
  * contrib/hbqt/qth/QFtp.qth
  * contrib/hbqt/qth/QHttp.qth
  * contrib/hbqt/QFtp.cpp
  * contrib/hbqt/QHttp.cpp
  * contrib/hbcurl/hbcurl.c
  * contrib/hbwin/win_prt.c
    ! Fixed similar to above allocation errors.

  * config/global.cf
    + Added HB_???_INSTALL initialization. Just a step, needs more
      work before making it a replacement for current method.
This commit is contained in:
Viktor Szakats
2009-07-23 17:22:31 +00:00
parent 2cefe1006f
commit 4a51d89404
16 changed files with 143 additions and 48 deletions

View File

@@ -17,6 +17,35 @@
past entries belonging to author(s): Viktor Szakats.
*/
2009-07-23 18:19 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
+ source/rtl/hbfeof.c
* source/rtl/Makefile
* source/rtl/philes.c
! HB_FEOF() moved to separate file to ease name collision
situations.
* contrib/hbssl/evpciph.c
* contrib/hbssl/bio.c
* contrib/hbssl/evpmd.c
* contrib/hbssl/evpenc.c
! Fixed buffer sizes, after valgrind test.
(off by one bugs. hb_storclen_buffer()/hb_retclen_buffer() need
one byte extra above the size returned, in order to hold the
EOS char)
* contrib/xhb/freadlin.c
* contrib/hbqt/qth/QFtp.qth
* contrib/hbqt/qth/QHttp.qth
* contrib/hbqt/QFtp.cpp
* contrib/hbqt/QHttp.cpp
* contrib/hbcurl/hbcurl.c
* contrib/hbwin/win_prt.c
! Fixed similar to above allocation errors.
* config/global.cf
+ Added HB_???_INSTALL initialization. Just a step, needs more
work before making it a replacement for current method.
2009-07-23 14:04 UTC+0200 Viktor Szakats (harbour.01 syenar.hu)
* contrib/hbssl/evpciph.c
+ EVP_OPENINIT(), EVP_OPENUPDATE(), EVP_OPENFINAL()

View File

@@ -362,6 +362,19 @@ ifneq ($(HB_DB_DRVEXT),)
HB_DB_DIRS += $(HB_DB_DRVEXT)
endif
ifeq ($(HB_BIN_INSTALL),)
export HB_BIN_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)bin
endif
ifeq ($(HB_LIB_INSTALL),)
export HB_LIB_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)lib$(LIBPOSTFIX)
endif
ifeq ($(HB_INC_INSTALL),)
export HB_INC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)include$(INCPOSTFIX)
endif
ifeq ($(HB_DOC_INSTALL),)
export HB_DOC_INSTALL := $(HB_INSTALL_PREFIX)$(DIRSEP)doc
endif
ifeq ($(HB_BIN_COMPILE),)
HB_HOST_BIN_DIR := $(TOP)$(ROOT)bin/$(ARCH_COMP)
else

View File

@@ -662,7 +662,7 @@ HB_FUNC( CURL_EASY_RECV )
if( size < 1024 )
size = 1024;
buffer = hb_xgrab( size );
buffer = hb_xgrab( size + 1 );
res = curl_easy_recv( hb_curl->curl, buffer, size, &size );

View File

@@ -86,7 +86,7 @@ HB_FUNC( QT_QFTP )
*/
HB_FUNC( QT_QFTP_READ )
{
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) );
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) + 1 );
qint64 iRead;
iRead = hbqt_par_QFtp( 1 )->read( iData, hb_parnint( 3 ) );
@@ -316,4 +316,3 @@ HB_FUNC( QT_QFTP_ABORT )
/*----------------------------------------------------------------------*/
#endif /* #if QT_VERSION >= 0x040500 */
/*----------------------------------------------------------------------*/

View File

@@ -86,7 +86,7 @@ HB_FUNC( QT_QHTTP )
*/
HB_FUNC( QT_QHTTP_READ )
{
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) );
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) + 1 );
qint64 iRead;
iRead = hbqt_par_QHttp( 1 )->read( iData, hb_parnint( 3 ) );
@@ -316,4 +316,3 @@ HB_FUNC( QT_QHTTP_ABORT )
/*----------------------------------------------------------------------*/
#endif /* #if QT_VERSION >= 0x040500 */
/*----------------------------------------------------------------------*/

View File

@@ -80,7 +80,7 @@ HB_FUNC( QT_QFTP )
*/
HB_FUNC( QT_QFTP_READ )
{
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) );
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) + 1 );
qint64 iRead;
iRead = hbqt_par_QFtp( 1 )->read( iData, hb_parnint( 3 ) );

View File

@@ -82,7 +82,7 @@ HB_FUNC( QT_QHTTP )
*/
HB_FUNC( QT_QHTTP_READ )
{
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) );
char * iData = ( char * ) hb_xgrab( hb_parnint( 3 ) + 1 );
qint64 iRead;
iRead = hbqt_par_QHttp( 1 )->read( iData, hb_parnint( 3 ) );

View File

@@ -453,7 +453,7 @@ HB_FUNC( BIO_READ )
if( size > 0 )
{
char * buffer = ( char * ) hb_xgrab( size );
char * buffer = ( char * ) hb_xgrab( size + 1 );
hb_retni( size = BIO_read( bio, buffer, size ) );
@@ -480,7 +480,7 @@ HB_FUNC( BIO_GETS )
if( size > 0 )
{
char * buffer = ( char * ) hb_xgrab( size );
char * buffer = ( char * ) hb_xgrab( size + 1 );
hb_retni( size = BIO_gets( bio, buffer, size ) );

View File

@@ -573,7 +573,7 @@ HB_FUNC( EVP_ENCRYPTUPDATE )
if( ctx )
{
int size = hb_parclen( 3 ) + EVP_CIPHER_CTX_block_size( ctx ) - 1;
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_EncryptUpdate( ctx,
buffer,
@@ -603,7 +603,7 @@ HB_FUNC( EVP_ENCRYPTFINAL )
if( ctx )
{
int size = EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_EncryptFinal( ctx, buffer, &size ) );
@@ -629,7 +629,7 @@ HB_FUNC( EVP_ENCRYPTFINAL_EX )
if( ctx )
{
int size = EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_EncryptFinal_ex( ctx, buffer, &size ) );
@@ -692,7 +692,7 @@ HB_FUNC( EVP_DECRYPTUPDATE )
if( ctx )
{
int size = hb_parclen( 3 ) + EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_DecryptUpdate( ctx,
buffer,
@@ -722,7 +722,7 @@ HB_FUNC( EVP_DECRYPTFINAL )
if( ctx )
{
int size = EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_DecryptFinal( ctx, buffer, &size ) );
@@ -748,7 +748,7 @@ HB_FUNC( EVP_DECRYPTFINAL_EX )
if( ctx )
{
int size = EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_DecryptFinal_ex( ctx, buffer, &size ) );
@@ -813,7 +813,7 @@ HB_FUNC( EVP_CIPHERUPDATE )
if( ctx )
{
int size = hb_parclen( 3 ) + EVP_CIPHER_CTX_block_size( ctx ) - 1;
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_CipherUpdate( ctx,
buffer,
@@ -843,7 +843,7 @@ HB_FUNC( EVP_CIPHERFINAL )
if( ctx )
{
int size = EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_CipherFinal( ctx, buffer, &size ) );
@@ -869,7 +869,7 @@ HB_FUNC( EVP_CIPHERFINAL_EX )
if( ctx )
{
int size = EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_CipherFinal_ex( ctx, buffer, &size ) );
@@ -913,15 +913,15 @@ HB_FUNC( EVP_SEALINIT )
unsigned char ** ek = ( unsigned char ** ) hb_xgrab( sizeof( unsigned char * ) * npubk );
int * ekl = ( int * ) hb_xgrab( sizeof( int ) * npubk );
int ivl = EVP_CIPHER_iv_length( cipher );
unsigned char * iv = ivl > 0 ? ( unsigned char * ) hb_xgrab( ivl ) : NULL;
EVP_PKEY ** pubk = ( EVP_PKEY ** ) hb_xgrab( sizeof( EVP_PKEY * ) * npubk );
unsigned char * iv = ivl > 0 ? ( unsigned char * ) hb_xgrab( ivl + 1 ) : NULL;
EVP_PKEY ** pubk = ( EVP_PKEY ** ) hb_xgrab( sizeof( EVP_PKEY * ) * npubk + 1 );
PHB_ITEM pPKEY;
int tmp;
for( tmp = 0; tmp < npubk; tmp++ )
{
pubk[ tmp ] = pkey1 ? pkey1 : ( EVP_PKEY * ) hb_arrayGetPtr( pArray, tmp + 1 );
ek[ tmp ] = ( unsigned char * ) hb_xgrab( EVP_PKEY_size( pubk[ tmp ] ) );
ek[ tmp ] = ( unsigned char * ) hb_xgrab( EVP_PKEY_size( pubk[ tmp ] ) + 1 );
ekl[ tmp ] = 0;
}
@@ -967,7 +967,7 @@ HB_FUNC( EVP_SEALUPDATE )
if( ctx )
{
int size = hb_parclen( 3 ) + EVP_CIPHER_CTX_block_size( ctx ) - 1;
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_SealUpdate( ctx,
buffer,
@@ -997,7 +997,7 @@ HB_FUNC( EVP_SEALFINAL )
if( ctx )
{
int size = EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_SealFinal( ctx, buffer, &size ) );
@@ -1044,7 +1044,7 @@ HB_FUNC( EVP_OPENUPDATE )
if( ctx )
{
int size = hb_parclen( 3 ) + EVP_CIPHER_CTX_block_size( ctx ) - 1;
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_OpenUpdate( ctx,
buffer,
@@ -1074,7 +1074,7 @@ HB_FUNC( EVP_OPENFINAL )
if( ctx )
{
int size = EVP_CIPHER_CTX_block_size( ctx );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
hb_retni( EVP_OpenFinal( ctx, buffer, &size ) );

View File

@@ -118,7 +118,7 @@ HB_FUNC( EVP_ENCODEUPDATE )
if( ctx )
{
int size = 512;
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
EVP_EncodeUpdate( ctx,
buffer,
@@ -148,7 +148,7 @@ HB_FUNC( EVP_ENCODEFINAL )
if( ctx )
{
int size = 512;
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
EVP_EncodeFinal( ctx, buffer, &size );
@@ -187,7 +187,7 @@ HB_FUNC( EVP_DECODEUPDATE )
if( ctx )
{
int size = 512;
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
EVP_DecodeUpdate( ctx,
buffer,
@@ -217,7 +217,7 @@ HB_FUNC( EVP_DECODEFINAL )
if( ctx )
{
int size = 512;
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( size + 1 );
EVP_DecodeFinal( ctx, buffer, &size );

View File

@@ -367,7 +367,7 @@ HB_FUNC( EVP_DIGESTFINAL )
if( ctx )
{
unsigned char * buffer = ( unsigned char * ) hb_xgrab( EVP_MAX_MD_SIZE );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( EVP_MAX_MD_SIZE + 1 );
unsigned int size = 0;
hb_retni( EVP_DigestFinal( ctx, buffer, &size ) );
@@ -393,7 +393,7 @@ HB_FUNC( EVP_DIGESTFINAL_EX )
if( ctx )
{
unsigned char * buffer = ( unsigned char * ) hb_xgrab( EVP_MAX_MD_SIZE );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( EVP_MAX_MD_SIZE + 1 );
unsigned int size = 0;
hb_retni( EVP_DigestFinal_ex( ctx, buffer, &size ) );
@@ -462,7 +462,7 @@ HB_FUNC( EVP_SIGNFINAL )
if( ctx )
{
unsigned char * buffer = ( unsigned char * ) hb_xgrab( EVP_MAX_MD_SIZE );
unsigned char * buffer = ( unsigned char * ) hb_xgrab( EVP_MAX_MD_SIZE + 1 );
unsigned int size = 0;
hb_retni( EVP_SignFinal( ctx, buffer, &size, hb_EVP_PKEY_par( 3 ) ) );

View File

@@ -345,7 +345,7 @@ HB_FUNC( WINPORTREAD )
HANDLE hCommPort = s_PortData[ Port ].Port;
DWORD NumberOfBytesRead;
lpBuffer = ( char * ) hb_xgrab( NumberOfBytesToRead );
lpBuffer = ( char * ) hb_xgrab( NumberOfBytesToRead + 1 );
s_WinFcn = FCNREADFILE;
s_WinError = 0;
if( ! ReadFile( hCommPort, lpBuffer, NumberOfBytesToRead, &NumberOfBytesRead, NULL ) )

View File

@@ -76,7 +76,7 @@ char * hb_fsReadLine( HB_FHANDLE hFileHandle, LONG * plBuffLen, const char ** Te
if( *plBuffLen < 10 )
*plBuffLen = READING_BLOCK;
pBuff = ( char * ) hb_xgrab( *plBuffLen );
pBuff = ( char * ) hb_xgrab( *plBuffLen + 1 );
do
{

View File

@@ -68,6 +68,7 @@ C_SOURCES=\
hbbit.c \
hbcrc.c \
hbhex.c \
hbfeof.c \
hbmd5.c \
hbntos.c \
hbfile.c \

View File

@@ -0,0 +1,68 @@
/*
* $Id$
*/
/*
* Harbour Project source code:
* HB_FEOF()
*
* Copyright 2000 David G. Holm <dholm@jsd-llc.com>
* www - http://www.harbour-project.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307 USA (or visit the web site http://www.gnu.org/).
*
* As a special exception, the Harbour Project gives permission for
* additional uses of the text contained in its release of Harbour.
*
* The exception is that, if you link the Harbour libraries with other
* files to produce an executable, this does not by itself cause the
* resulting executable to be covered by the GNU General Public License.
* Your use of that executable is in no way restricted on account of
* linking the Harbour library code into it.
*
* This exception does not however invalidate any other reasons why
* the executable file might be covered by the GNU General Public License.
*
* This exception applies only to the code released by the Harbour
* Project under the name Harbour. If you copy code from other
* Harbour Project or Free Software Foundation releases into a copy of
* Harbour, as the General Public License permits, the exception does
* not apply to the code that you add in this way. To avoid misleading
* anyone as to the status of such modified files, you must delete
* this exception notice from them.
*
* If you write modifications of your own for Harbour, it is your choice
* whether to permit this exception to apply to your modifications.
* If you do not wish that, delete this exception notice.
*
*/
#include "hbapi.h"
#include "hbapifs.h"
HB_FUNC( HB_FEOF )
{
USHORT uiError = 6;
if( HB_ISNUM( 1 ) )
{
hb_retl( hb_fsEof( hb_numToHandle( hb_parnint( 1 ) ) ) );
uiError = hb_fsError();
}
else
hb_retl( TRUE );
hb_fsSetFError( uiError );
}

View File

@@ -311,20 +311,6 @@ HB_FUNC( HB_DIRBASE )
hb_retc( szBuffer );
}
HB_FUNC( HB_FEOF )
{
USHORT uiError = 6;
if( HB_ISNUM( 1 ) )
{
hb_retl( hb_fsEof( hb_numToHandle( hb_parnint( 1 ) ) ) );
uiError = hb_fsError();
}
else
hb_retl( TRUE );
hb_fsSetFError( uiError );
}
HB_FUNC( HB_FCOMMIT )
{
USHORT uiError = 6;