Permalink
Browse files

Correct string buffer sizes for RTF output, such that the string is a…

…lways correctly sized.
  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Jan 3, 2015
1 parent a1f2872 commit bc8e705cf90cecdff8a247264c249ffed1d2af4a
Showing with 5 additions and 0 deletions.
  1. +5 −0 src/rtfgen.cpp
@@ -2365,17 +2365,21 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl
int len;
do
{
lineBuf.resize(maxLineLength);
if ((len=f.readLine(lineBuf.rawData(),maxLineLength))==-1)
{
err("read error in %s before end of RTF header!\n",infName.data());
return FALSE;
}
lineBuf.resize(len+1);
if (bIncludeHeader) encodeForOutput(t,lineBuf.data());
} while (lineBuf.find("\\comment begin body")==-1);
lineBuf.resize(maxLineLength);
while ((len=f.readLine(lineBuf.rawData(),maxLineLength))!=-1)
{
lineBuf.resize(len+1);
int pos;
if ((pos=lineBuf.find("INCLUDETEXT"))!=-1)
{
@@ -2407,6 +2411,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl
encodeForOutput(t,lineBuf);
}
}
lineBuf.resize(maxLineLength);
}
f.close();
// remove temporary file

0 comments on commit bc8e705

Please sign in to comment.