• Erkki Seppälä's avatar
    cmsProp: don't deal with uninitialized values, fail instead · 07fae919
    Erkki Seppälä authored
    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: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com>
    Reviewed-by: 's avatarAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com>
    Reviewed-by: 's avatarRami Ylimäki <rami.ylimaki@vincit.fi>
    Signed-off-by: 's avatarErkki Seppälä <erkki.seppala@vincit.fi>
    Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
    07fae919
Name
Last commit
Last update
bin Loading commit data...
debian Loading commit data...
doc Loading commit data...
etc Loading commit data...
nx-X11 Loading commit data...
nxcomp Loading commit data...
nxcompext Loading commit data...
nxcompshad Loading commit data...
nxproxy Loading commit data...
testscripts Loading commit data...
COPYING Loading commit data...
ChangeLog Loading commit data...
LICENSE Loading commit data...
LICENSE.nxcomp Loading commit data...
Makefile Loading commit data...
README.NX-development Loading commit data...
README.md Loading commit data...
VERSION Loading commit data...
fix-patch-whitespace Loading commit data...
make-changelog.sh Loading commit data...
nx-libs.spec Loading commit data...
replace.sh Loading commit data...
roll-tarballs.sh Loading commit data...
version.sh Loading commit data...