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/template.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/template.cpp')
-rw-r--r-- | src/template.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/template.cpp b/src/template.cpp index 9fa03aa..a9fab94 100644 --- a/src/template.cpp +++ b/src/template.cpp @@ -4395,7 +4395,7 @@ TemplateLexer::TemplateLexer(const TemplateEngine *engine,const QCString &fileNa m_engine(engine), m_fileName(fileName) { m_data.resize(size+1); - memcpy(m_data.data(),data,size); + memcpy(m_data.rawData(),data,size); m_data[size]=0; } @@ -4602,7 +4602,7 @@ void TemplateLexer::addToken(QList<TemplateToken> &tokens, { int len = endPos-startPos+1; QCString text(len); - qstrncpy(text.data(),data+startPos,len); + qstrncpy(text.rawData(),data+startPos,len); if (type!=TemplateToken::Text) text = text.stripWhiteSpace(); tokens.append(new TemplateToken(type,text,line)); } |