Fix buffer overrun in Obj-loader (this is related to [2970556]).

git-svn-id: https://assimp.svn.sourceforge.net/svnroot/assimp/trunk@610 67173fc5-114c-0410-ac8e-9d2fd5bffc1f
pull/1/head
aramis_acg 2010-03-16 00:04:17 +00:00
parent 77a00c6d27
commit 70c4eb4d3a
1 changed files with 3 additions and 2 deletions

View File

@ -201,9 +201,10 @@ void ObjFileParser::copyNextLine(char *pBuffer, size_t length)
size_t index = 0;
while (m_DataIt != m_DataItEnd)
{
if (*m_DataIt == '\n' || *m_DataIt == '\r')
// (Aramis) removed assertion (index<length-1) in favour of an explicit check
if (*m_DataIt == '\n' || *m_DataIt == '\r' || index == length-1)
break;
assert (index+1 <= length);
pBuffer[ index ] = *m_DataIt;
++index;
++m_DataIt;