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-9d2fd5bffc1fpull/1/head
parent
77a00c6d27
commit
70c4eb4d3a
|
@ -201,9 +201,10 @@ void ObjFileParser::copyNextLine(char *pBuffer, size_t length)
|
||||||
size_t index = 0;
|
size_t index = 0;
|
||||||
while (m_DataIt != m_DataItEnd)
|
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;
|
break;
|
||||||
assert (index+1 <= length);
|
|
||||||
pBuffer[ index ] = *m_DataIt;
|
pBuffer[ index ] = *m_DataIt;
|
||||||
++index;
|
++index;
|
||||||
++m_DataIt;
|
++m_DataIt;
|
||||||
|
|
Loading…
Reference in New Issue