Kaydet (Commit) d6ce524d authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1242671 Untrusted value as argument

Change-Id: Ic810391c9ecfef9f28aba34cdc0f85d42ebf656f
üst 6c761698
......@@ -1634,15 +1634,18 @@ void Sc10Import::LoadCol(SCCOL Col, SCTAB Tab)
nError = errUnknownFormat;
break;
}
sal_uInt16 NoteLen;
rStream.ReadUInt16( NoteLen );
if (NoteLen != 0)
sal_uInt16 nNoteLen(0);
rStream.ReadUInt16(nNoteLen);
size_t nAvailable = rStream.remainingSize();
if (nNoteLen > nAvailable)
nNoteLen = nAvailable;
if (nNoteLen != 0)
{
boost::scoped_array<sal_Char> pNote(new sal_Char[NoteLen+1]);
rStream.Read(pNote.get(), NoteLen);
pNote[NoteLen] = 0;
OUString aNoteText( SC10TOSTRING(pNote.get()));
pNote.reset();
boost::scoped_array<sal_Char> xNote(new sal_Char[nNoteLen+1]);
nNoteLen = rStream.Read(xNote.get(), nNoteLen);
xNote[nNoteLen] = 0;
OUString aNoteText( SC10TOSTRING(xNote.get()));
xNote.reset();
ScAddress aPos( Col, static_cast<SCROW>(Row), Tab );
ScNoteUtil::CreateNoteFromString( *pDoc, aPos, aNoteText, false, false );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment