From fa6841b0cb4ee260d1a9d5017e614ec8b2b57eea Mon Sep 17 00:00:00 2001 From: "David G. Holm" Date: Sat, 31 Jul 1999 06:46:32 +0000 Subject: [PATCH] See ChangeLog entry 19990731-02:30 EDT David G. Holm --- harbour/ChangeLog | 6 ++++++ harbour/source/hbpp/hbpplib.c | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/harbour/ChangeLog b/harbour/ChangeLog index a74ce7b831..b6f42505c7 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -1,3 +1,9 @@ +19990731-02:30 EDT David G. Holm + * source/hbpp/hbpplib.c + ! ParseExpression() expects a null-terminated string. + ! ParseExpression() returns the parsed input in the input + string, not in the output string. + 19990731-06:50 CET Victor Szel * include/extend.h include/hbdefs.h diff --git a/harbour/source/hbpp/hbpplib.c b/harbour/source/hbpp/hbpplib.c index c59fb96634..574f775326 100644 --- a/harbour/source/hbpp/hbpplib.c +++ b/harbour/source/hbpp/hbpplib.c @@ -65,9 +65,11 @@ HARBOUR HB_PREPROCESS(void) char *pOut = (char *)hb_xgrab(STR_SIZE); char *ptr = pText; - int resParse; + int slen, resParse; - memcpy(pText, hb_parc(1), MIN(hb_parclen(1), STR_SIZE)); + slen = MIN(hb_parclen(1), STR_SIZE - 1); + memcpy(pText, hb_parc(1), slen); + pText[slen] = 0; /* Preprocessor expects null-terminated string */ memset(pOut, 0, STR_SIZE); SKIPTABSPACES( ptr ); @@ -77,7 +79,7 @@ HARBOUR HB_PREPROCESS(void) // Some error here? } - hb_retc(pOut); + hb_retc(pText); /* Preprocessor returns parsed line in input buffer */ hb_xfree(pText); hb_xfree(pOut);