Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Correct string buffer sizes for RTF output, such that the string is a…
…lways correctly sized.
  • Loading branch information
Dimitri van Heesch committed Jan 3, 2015
1 parent a1f2872 commit bc8e705
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/rtfgen.cpp
Expand Up @@ -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)
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit bc8e705

Please sign in to comment.