You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by db...@apache.org on 2004/02/12 06:28:23 UTC

cvs commit: xml-xalan/c/src/xalanc/PlatformSupport XalanInMemoryMessageLoader.cpp

dbertoni    2004/02/11 21:28:23

  Modified:    c/src/xalanc/PlatformSupport XalanInMemoryMessageLoader.cpp
  Log:
  Don't try to load more characters than will fit in the buffer.
  
  Revision  Changes    Path
  1.4       +14 -7     xml-xalan/c/src/xalanc/PlatformSupport/XalanInMemoryMessageLoader.cpp
  
  Index: XalanInMemoryMessageLoader.cpp
  ===================================================================
  RCS file: /home/cvs/xml-xalan/c/src/xalanc/PlatformSupport/XalanInMemoryMessageLoader.cpp,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XalanInMemoryMessageLoader.cpp	6 Jan 2004 02:41:28 -0000	1.3
  +++ XalanInMemoryMessageLoader.cpp	12 Feb 2004 05:28:23 -0000	1.4
  @@ -88,19 +88,26 @@
   	{
   		if (XalanMsgContainer::getNumbOfMsgs() < (unsigned int)msgToLoad)
   		{
  -			XalanCopy(m_unknownMessage.c_str(), m_unknownMessage.c_str() + m_unknownMessage.length() + 1 , toFill);
  +			const XalanDOMString::size_type		msgLength =
  +                m_unknownMessage.length() + 1;
  +
  +			XalanCopy(
  +                m_unknownMessage.c_str(),
  +                m_unknownMessage.c_str() + (msgLength < maxChars ? msgLength : maxChars),
  +                toFill);
   		}
   		else
   		{
   			const XalanDOMChar* const	pErrMsg = XalanMsgContainer::getMessage(msgToLoad);
  +			assert (pErrMsg != 0);
   
  -			assert ( pErrMsg != 0 );
  -			
  -			const XalanDOMString::size_type		msgLength = XalanDOMString::length(pErrMsg);
  -
  -			assert ( msgLength <= maxChars );
  +			const XalanDOMString::size_type		msgLength =
  +                XalanDOMString::length(pErrMsg) + 1;
   
  -			XalanCopy(pErrMsg, pErrMsg + msgLength + 1, toFill);
  +            XalanCopy(
  +                pErrMsg,
  +                pErrMsg + (msgLength < maxChars ? msgLength : maxChars),
  +                toFill);
   		}
   
   		return true;
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org