diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2015-01-02 08:56:45 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-01-02 09:45:18 (GMT) |
commit | 312bef563a5be72f6423377247db1b80044bf711 (patch) | |
tree | 3a656445fa67469b2f1783932fe127e9f39af69a /src/rtfgen.cpp | |
parent | ed39dab59f8af2c5b42cfac0b3140cf594412121 (diff) | |
download | Doxygen-312bef563a5be72f6423377247db1b80044bf711.zip Doxygen-312bef563a5be72f6423377247db1b80044bf711.tar.gz Doxygen-312bef563a5be72f6423377247db1b80044bf711.tar.bz2 |
Fixed a couple of cases where sharing string data could lead to corruption
Also made dangerous string access more visible by introducing rawData().
This replaces data() which will now return a constant string.
Diffstat (limited to 'src/rtfgen.cpp')
-rw-r--r-- | src/rtfgen.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index 354469b..2a6fd07 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -2362,19 +2362,22 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl // this is EXTREEEEEEEMLY brittle. It works on OUR rtf // files because the first line before the body // ALWAYS contains "{\comment begin body}" + int len; do { - if (f.readLine(lineBuf.data(),maxLineLength)==-1) + 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); - while (f.readLine(lineBuf.data(),maxLineLength)!=-1) + while ((len=f.readLine(lineBuf.rawData(),maxLineLength))!=-1) { + lineBuf.resize(len+1); int pos; if ((pos=lineBuf.find("INCLUDETEXT"))!=-1) { |