path: root/src/crc32.c
diff options
authorArtyom V. Poptsov <poptsov.artyom@gmail.com>2021-08-15 22:50:33 +0300
committerJakub Jelen <jjelen@redhat.com>2021-09-15 11:04:45 +0200
commit1ab2340644109442f933b1fb47dee927bed29f8e (patch)
tree269a50be86cb37e91336072d8d5213732c51ca29 /src/crc32.c
parent76b7e0e9b54bed74f3d9be75583e56960405847d (diff)
channels: Fix segfaults when the channel data is freed
Calling some channel procedures on a freed channel is always resulting in segmentation fault errors. The reason is that when a channel is freed with 'ssh_channel_do_free' procedure, its 'session' field is set to NULL; then when a channel procedure tries to access any field of 'channel->session' structure it is effectively dereferencing a NULL pointer. The change fixes that behavior by adding a check which ensures that a channel state is not SSH_CHANNEL_FLAG_FREED_LOCAL before accessing its parent session. Also the test suite is updated to check for the fixed errors, and the Doxygen documentation updated accordingly. There was a bug introduced in b0fb7d15: 'ssh_channel_poll', 'ssh_channel_poll_timeout' and 'ssh_channel_get_exit_status' would compare the channel state to the 'SSH_CHANNEL_FLAG_FREED_LOCAL' constant to check if the channel is alive. But the procedures must check the channel flags for the presence of 'SSH_CHANNEL_FLAG_FREED_LOCAL' bits instead. This change fixes the bug. Signed-off-by: Artyom V. Poptsov <poptsov.artyom@gmail.com> Reviewed-by: Jakub Jelen <jjelen@redhat.com>
Diffstat (limited to 'src/crc32.c')
0 files changed, 0 insertions, 0 deletions