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 /qtools/qutfcodec.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 'qtools/qutfcodec.cpp')
-rw-r--r-- | qtools/qutfcodec.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/qtools/qutfcodec.cpp b/qtools/qutfcodec.cpp index c7094ad..a37e37f 100644 --- a/qtools/qutfcodec.cpp +++ b/qtools/qutfcodec.cpp @@ -203,14 +203,14 @@ public: if ( headerdone ) { len_in_out = uc.length()*(int)sizeof(QChar); QCString d(len_in_out); - memcpy(d.data(),uc.unicode(),len_in_out); + memcpy(d.rawData(),uc.unicode(),len_in_out); return d; } else { headerdone = TRUE; len_in_out = (1+uc.length())*(int)sizeof(QChar); QCString d(len_in_out); - memcpy(d.data(),&QChar::byteOrderMark,sizeof(QChar)); - memcpy(d.data()+sizeof(QChar),uc.unicode(),uc.length()*sizeof(QChar)); + memcpy(d.rawData(),&QChar::byteOrderMark,sizeof(QChar)); + memcpy(d.rawData()+sizeof(QChar),uc.unicode(),uc.length()*sizeof(QChar)); return d; } } |