2006-03-29 11:55 UTC+0100 Ryszard Glab <rglab//imid.med.pl>

* include/hbpp.h
      *fixed declaration of hb_pp_StreamBlock

   * source/pp/ppcore.c
      * added two guards for buffer overflow
This commit is contained in:
Ryszard Glab
2006-03-29 09:48:28 +00:00
parent b9ee88d465
commit a579fbc805
3 changed files with 24 additions and 4 deletions

View File

@@ -8,6 +8,14 @@
2002-12-01 13:30 UTC+0100 Foo Bar <foo.bar@foobar.org>
*/
* source/pp/ppcore.c
* source/compiler/harbour.l
* fixed compilation of macro expression (the first letter
was eaten in some cases)
* source/pp/ppcore.c
* source/pp/pplib.c
* fixed calls to hb_pp_ParseDirective
* increased back the input buffer to HB_PP_STR_SIZE (12288 bytes)

View File

@@ -113,7 +113,7 @@ extern char * hb_pp_szErrors[];
extern char * hb_pp_szWarnings[];
extern int hb_pp_nEmptyStrings;
extern int hb_pp_LastOutLine;
extern BOOL hb_pp_StreamBlock;
extern int hb_pp_StreamBlock;
extern BOOL hb_pp_NestedLiteralString;
extern BOOL hb_pp_LiteralEscSeq;
extern unsigned int hb_pp_MaxTranslateCycles;

View File

@@ -2137,7 +2137,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL
char *expreal = ( char * ) hb_xgrab( MAX_EXP );
char *exppatt = ( char * ) hb_xgrab( MAX_NAME );
#endif
int lenreal = 0, maxlenreal = HB_PP_STR_SIZE, lenpatt;
int lenreal = 0, maxlenreal = MAX_EXP/*HB_PP_STR_SIZE*/, lenpatt;
int rezrestr, ipos, nBra;
char *ptr, *ptrtemp;
@@ -2211,7 +2211,7 @@ static int WorkMarkers( char **ptrmp, char **ptri, char *ptro, int *lenres, BOOL
}
else
{
maxlenreal = ipos - 1;
maxlenreal = ipos;
lenreal = 0;
}
}
@@ -2900,6 +2900,10 @@ static int getExpReal( char *expreal, char **ptri, BOOL prlist, int maxrez, BOOL
lens++;
}
}
if( !rez && lens >= maxrez )
{
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL );
}
if( expreal != NULL && expreal > cStart )
{
@@ -3220,7 +3224,15 @@ static void SearnRep( char *exppatt, char *expreal, int lenreal, char *ptro, int
{
lennew = ptr2 - ptr - 1;
memcpy( expnew, ptr + 1, lennew );
if( lennew < MAX_EXP )
{
memcpy( expnew, ptr + 1, lennew );
}
else
{
hb_compGenError( hb_pp_szErrors, 'F', HB_PP_ERR_BUFFER_OVERFLOW, NULL, NULL );
return;
}
*( expnew + lennew++ ) = ' ';
*( expnew + lennew ) = '\0';
while( ( i = hb_strAt( exppatt, 2, expnew, lennew ) ) > 0 )