diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2014-11-02 12:32:37 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2014-11-02 12:32:37 (GMT) |
commit | e5076edf2c103d262a9e32d57fb40cfe210c9ddf (patch) | |
tree | 16d49b922b82d6e71681c5f1e215dc6e0830e568 /src | |
parent | c83db38ea83499be19d9ff242bfa22ae534ee80c (diff) | |
download | Doxygen-e5076edf2c103d262a9e32d57fb40cfe210c9ddf.zip Doxygen-e5076edf2c103d262a9e32d57fb40cfe210c9ddf.tar.gz Doxygen-e5076edf2c103d262a9e32d57fb40cfe210c9ddf.tar.bz2 |
Fixed issue accessing uninitialized data when combining RTF output.
Diffstat (limited to 'src')
-rw-r--r-- | src/rtfgen.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/rtfgen.cpp b/src/rtfgen.cpp index ccdadcf..c0dca5b 100644 --- a/src/rtfgen.cpp +++ b/src/rtfgen.cpp @@ -2268,11 +2268,12 @@ bool isLeadBytes(int c) // note: function is not reentrant! -static void encodeForOutput(FTextStream &t,const QCString &s) +static void encodeForOutput(FTextStream &t,const char *s) { + if (s==0) return; QCString encoding; bool converted=FALSE; - int l = s.length(); + int l = qstrlen(s); static QByteArray enc; if (l*4>(int)enc.size()) enc.resize(l*4); // worst case encoding.sprintf("CP%s",theTranslator->trRTFansicp().data()); @@ -2284,7 +2285,7 @@ static void encodeForOutput(FTextStream &t,const QCString &s) { size_t iLeft=l; size_t oLeft=enc.size(); - char *inputPtr = s.data(); + char *inputPtr = (char*)s; char *outputPtr = enc.data(); if (!portable_iconv(cd, &inputPtr, &iLeft, &outputPtr, &oLeft)) { @@ -2296,7 +2297,7 @@ static void encodeForOutput(FTextStream &t,const QCString &s) } if (!converted) // if we did not convert anything, copy as is. { - memcpy(enc.data(),s.data(),l); + memcpy(enc.data(),s,l); enc.resize(l); } uint i; @@ -2355,7 +2356,7 @@ static bool preProcessFile(QDir &d,QCString &infName, FTextStream &t, bool bIncl err("read error in %s before end of RTF header!\n",infName.data()); return FALSE; } - if (bIncludeHeader) encodeForOutput(t,lineBuf); + if (bIncludeHeader) encodeForOutput(t,lineBuf.data()); } while (lineBuf.find("\\comment begin body")==-1); |