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/docparser.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/docparser.cpp')
-rw-r--r-- | src/docparser.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/docparser.cpp b/src/docparser.cpp index 9a120dc..540eb91 100644 --- a/src/docparser.cpp +++ b/src/docparser.cpp @@ -236,7 +236,8 @@ static void docParserPopContext(bool keepParamInfo=FALSE) // replaces > with < and > with > within string s static void unescapeCRef(QCString &s) { - char *p = s.data(); + QCString tmp(s); + char *p = tmp.rawData(); if (p) { char c; @@ -247,8 +248,9 @@ static void unescapeCRef(QCString &s) } } - s=substitute(s,"<","<"); - s=substitute(s,">",">"); + tmp=substitute(tmp,"<","<"); + tmp=substitute(tmp,">",">"); + s = tmp; } //--------------------------------------------------------------------------- @@ -6939,7 +6941,7 @@ static QCString extractCopyDocId(const char *data, uint &j, uint len) } e=j; QCString id(e-s+1); - if (e>s) memcpy(id.data(),data+s,e-s); + if (e>s) memcpy(id.rawData(),data+s,e-s); id.at(e-s)='\0'; //printf("extractCopyDocId='%s' input='%s'\n",id.data(),&data[s]); return id; |