]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
upstream: Make the display number check relative to
authordtucker@openbsd.org <dtucker@openbsd.org>
Sat, 24 May 2025 08:09:32 +0000 (08:09 +0000)
committerDarren Tucker <dtucker@dtucker.net>
Sat, 24 May 2025 09:05:38 +0000 (19:05 +1000)
X11DisplayOffset.

This will allows people to use X11DisplayOffset to configure much higher
port ranges if they really want, while not changing the default behaviour.
Patch from Roman Gubarev via github PR#559, ok djm@

OpenBSD-Commit-ID: e0926af5dc0c11e364452b624c3ad0cda88550b5

channels.c

index bfe2e3b2d4f74c39e84c175edcbf069def3e506a..5d503025fec281a792169ab766cea95b1b1add3c 100644 (file)
@@ -1,4 +1,4 @@
-/* $OpenBSD: channels.c,v 1.442 2024/12/05 06:49:26 dtucker Exp $ */
+/* $OpenBSD: channels.c,v 1.443 2025/05/24 08:09:32 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -5010,7 +5010,7 @@ x11_create_display_inet(struct ssh *ssh, int x11_display_offset,
                return -1;
 
        for (display_number = x11_display_offset;
-           display_number < MAX_DISPLAYS;
+           display_number < x11_display_offset + MAX_DISPLAYS;
            display_number++) {
                port = X11_BASE_PORT + display_number;
                memset(&hints, 0, sizeof(hints));
@@ -5065,7 +5065,7 @@ x11_create_display_inet(struct ssh *ssh, int x11_display_offset,
                if (num_socks > 0)
                        break;
        }
-       if (display_number >= MAX_DISPLAYS) {
+       if (display_number >= x11_display_offset + MAX_DISPLAYS) {
                error("Failed to allocate internet-domain X11 display socket.");
                return -1;
        }