diff options
author | Erkki Seppälä <erkki.seppala@vincit.fi> | 2011-02-03 17:08:57 +0200 |
---|---|---|
committer | Ulrich Sibiller <uli42@gmx.de> | 2016-10-19 21:40:24 +0200 |
commit | 07fae919a4474abfb55f41ed3d07bf93e74e9154 (patch) | |
tree | 65ab0434beb56d7467b0660c51529b9c9258eaae /nx-X11/lib/X11/X11-def.cpp | |
parent | ae4e7538e078aff5db75af7b5fafdbb5658cbbb6 (diff) | |
download | nx-libs-07fae919a4474abfb55f41ed3d07bf93e74e9154.tar.gz nx-libs-07fae919a4474abfb55f41ed3d07bf93e74e9154.tar.bz2 nx-libs-07fae919a4474abfb55f41ed3d07bf93e74e9154.zip |
cmsProp: don't deal with uninitialized values, fail instead
Properly handle the return value of XGetWindowProperty by considering
if after the loop as well.
Using freed pointer "prop_ret"
There were numerous things wrong in how this function interacted with
XGetWindowProperty.
None of the local variables were initialized and remained that way if
the call to XGetWindowProperty returned 1 (not Succeed). That doesn't
result in after_ret being initialized in which case if it happens to
be 0, the loop was exited. In that case format_ret and nitems_ret were
uninitialized and the function might return with success (but with
uninitialized pointer in prop_ret) or XcmsFailure.
As the buffer enlarging code was called only when XGetWindowProperty
failed (returned not Success), after_ret would not have been
initialized. It would have been initialized only if the
XGetWindowProperty has returned Success earlier, but in that case the
code fragment would not have been reached.
This patch alters the function to return XcmsFailure if the call to
XGetWindowProperty fails.
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
Reviewed-by: Rami Ylimäki <rami.ylimaki@vincit.fi>
Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi>
Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib/X11/X11-def.cpp')
0 files changed, 0 insertions, 0 deletions