simon-git: putty (main): Simon Tatham

Commits to Tartarus hosted VCS tartarus-commits at lists.tartarus.org
Wed Jun 25 19:45:41 BST 2025


TL;DR:
  26a8ef37 Fix crash in utmp-stamping on Wayland.

Repository:     https://git.tartarus.org/simon/putty.git
On the web:     https://git.tartarus.org/?p=simon/putty.git
Branch updated: main
Committer:      Simon Tatham <anakin at pobox.com>
Date:           2025-06-25 19:45:41

commit 26a8ef376daf5f50c441a65691b84f87df49db9b
web diff https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=26a8ef376daf5f50c441a65691b84f87df49db9b;hp=91ad3af01c45cc43e2705569dc1555789f2fd3f6
Author: Simon Tatham <anakin at pobox.com>
Date:   Wed Jun 25 13:02:56 2025 +0100

    Fix crash in utmp-stamping on Wayland.
    
    Thanks to Colin Watson for the report: if pterm is both
    able (appropriately setgid) and willing (given the right options) to
    stamp utmp, it will use $DISPLAY as the location to write into utmp,
    and segfault if it's not set. But in a Wayland-only system it might
    very well not be set.
    
    To fix this I've generalised seat_get_x_display() into
    seat_get_display(), so that it can also return a display id string
    like "wayland-0" if that's what's appropriate. So now in that
    situation pterm will stamp utmp with a Wayland display id in place of
    an X11 one.
    
    However, seat_get_x_display() was also used to retrieve an X11 display
    name specifically so as to populate $DISPLAY in the terminal's shell.
    So the new seat_get_display() has a parameter to constrain the
    returned display to be of a particular type, or NULL if that type
    isn't available.
    
    As a final fallback, in case seat_get_display(seat, SDISP_ANY) might
    _still_ manage to return NULL for any reason, we catch that and turn
    it into the empty string before stamping utmp, so that we still won't
    segfault.

 proxy/sshproxy.c  |  2 +-
 pscp.c            |  2 +-
 psftp.c           |  2 +-
 putty.h           | 20 ++++++++++++++------
 ssh/server.c      |  2 +-
 ssh/sesschan.c    |  4 ++--
 stubs/null-seat.c |  3 ++-
 unix/plink.c      |  2 +-
 unix/pty.c        |  7 +++++--
 unix/window.c     | 14 +++++++-------
 utils/tempseat.c  |  6 +++---
 windows/plink.c   |  2 +-
 windows/window.c  |  2 +-
 13 files changed, 40 insertions(+), 28 deletions(-)



More information about the tartarus-commits mailing list