diff options
author | Denis Dzyubenko <denis.dzyubenko@nokia.com> | 2010-10-06 08:31:37 (GMT) |
---|---|---|
committer | Samuli Piippo <samuli.piippo@digia.com> | 2011-06-09 10:07:03 (GMT) |
commit | 3650691c505607d5af7b2c7e7e2ab9db1739c836 (patch) | |
tree | 6c6d23b3ddd69e900e269c58a57f02ee6cea755b /src/gui/kernel/qdnd_x11.cpp | |
parent | b8113220499fa8384bc2fbcc17aba59b636f2d48 (diff) | |
download | Qt-3650691c505607d5af7b2c7e7e2ab9db1739c836.zip Qt-3650691c505607d5af7b2c7e7e2ab9db1739c836.tar.gz Qt-3650691c505607d5af7b2c7e7e2ab9db1739c836.tar.bz2 |
Fixed a buffer overrun when pasting large data from non-Qt apps
When we receive a COMPOUND_TEXT data and convert it to multi-byte, if
the new length is less than the original buffer, we resize the buffer,
but then we need to make sure we reset the buffer_offset variable,
which is returned as a "size" of the buffer to a caller.
The conversion to COMPOUND_TEXT format was totally wrong, we were using
the wrong length of the input text, so the converted string was
truncated.
Task-number: QTBUG-8644
Reviewed-by: Bradley T. Hughes
(cherry picked from commit 4b81cb847647450f4bad8a0d9a278d43ebdfecc6)
Diffstat (limited to 'src/gui/kernel/qdnd_x11.cpp')
-rw-r--r-- | src/gui/kernel/qdnd_x11.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/gui/kernel/qdnd_x11.cpp b/src/gui/kernel/qdnd_x11.cpp index e681818..330fb3e 100644 --- a/src/gui/kernel/qdnd_x11.cpp +++ b/src/gui/kernel/qdnd_x11.cpp @@ -1862,7 +1862,7 @@ static QVariant xdndObtainData(const char *format, QVariant::Type requestedType) if (got) { Atom type; - if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0, false)) { + if (X11->clipboardReadProperty(tw->effectiveWinId(), ATOM(XdndSelection), true, &result, 0, &type, 0)) { if (type == ATOM(INCR)) { int nbytes = result.size() >= 4 ? *((int*)result.data()) : 0; result = X11->clipboardReadIncrementalProperty(tw->effectiveWinId(), ATOM(XdndSelection), nbytes, false); |