Skip to content

Commit

Permalink
Add guards to xrdp_mm_module_cleanup
Browse files Browse the repository at this point in the history
Adds pointer checks to less commonly used codepaths to prevent
a possible SEGV on process shutdown.
  • Loading branch information
matt335672 committed Aug 6, 2024
1 parent ba0b6fd commit 413c8c8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions xrdp/xrdp_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,15 @@ xrdp_mm_module_cleanup(struct xrdp_mm *self)
self->mod = 0;
self->mod_handle = 0;

if (self->wm->hide_log_window)
if (self->wm && self->wm->hide_log_window)
{
/* make sure autologin is off */
self->wm->session->client_info->rdp_autologin = 0;
/* make sure autologin is off.
* Check pointers are valid in case we're ending the process */
if (self->wm->session != NULL &&
self->wm->session->client_info != NULL)
{
self->wm->session->client_info->rdp_autologin = 0;
}
xrdp_wm_set_login_state(self->wm, WMLS_RESET); /* reset session */
}

Expand Down

0 comments on commit 413c8c8

Please sign in to comment.