From b1b49a56027a0a5c6c5e937428d9d7bf711b561b Mon Sep 17 00:00:00 2001 From: Jens-Heiner Rechtien Date: Tue, 15 Apr 2003 17:43:40 +0000 Subject: INTEGRATION: CWS adc5 (1.6.18); FILE MERGED 2003/04/14 14:49:07 np 1.6.18.1: 107553 --- xml2cmp/source/xcd/parse.cxx | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) (limited to 'xml2cmp') diff --git a/xml2cmp/source/xcd/parse.cxx b/xml2cmp/source/xcd/parse.cxx index a79cd91688d8..e95b880cefd2 100644 --- a/xml2cmp/source/xcd/parse.cxx +++ b/xml2cmp/source/xcd/parse.cxx @@ -2,9 +2,9 @@ * * $RCSfile: parse.cxx,v $ * - * $Revision: 1.6 $ + * $Revision: 1.7 $ * - * last change: $Author: np $Date: 2002/08/08 16:08:20 $ + * last change: $Author: hr $Date$ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -383,23 +383,27 @@ X2CParser::GetTextTill( Simstr & o_rText, if (i_bReverseName) { - char * sBreak = strrchr(pResult,'.'); - if (sBreak != 0) + const nMaxLen = 1000; + if (strlen(pResult) < nMaxLen) { - static char sScope[1000]; - static char sName[1000]; - - unsigned nScopeLen = sBreak - pResult; - strncpy ( sScope, pResult, nScopeLen ); - sScope[nScopeLen] = '\0'; - strcpy( sName, sBreak + 1 ); - strcat( sName, " in " ); - strcat( sName, sScope ); - - o_rText = sName; - return; + char * sBreak = strrchr(pResult,'.'); + if (sBreak != 0) + { + static char sScope[nMaxLen+10]; + static char sName[nMaxLen+10]; + + unsigned nScopeLen = sBreak - pResult; + strncpy ( sScope, pResult, nScopeLen ); // STRNCPY SAFE HERE + sScope[nScopeLen] = '\0'; + strcpy( sName, sBreak + 1 ); // STRCPY SAFE HERE + strcat( sName, " in " ); // STRCAT SAFE HERE + strcat( sName, sScope ); // STRCAT SAFE HERE + + o_rText = sName; + return; + } } - } + } // endif (i_bReverseName) o_rText = &sWord[0]; } -- cgit