| 1 | Taken from:
|
| 2 | https://gitlab.freedesktop.org/xorg/lib/libxcb/-/commit/6a7661f60a70ff42c64b32a725edcbee790d1c0d
|
| 3 |
|
| 4 | From 6a7661f60a70ff42c64b32a725edcbee790d1c0d Mon Sep 17 00:00:00 2001
|
| 5 | From: Samuel Thibault <[email protected]>
|
| 6 | Date: Tue, 8 Jul 2025 13:29:00 +0200
|
| 7 | Subject: [PATCH] Get rid of PATH_MAX
|
| 8 |
|
| 9 | There could be no upper limit on the length of a path according
|
| 10 | to POSIX, therefore these macros may not be defined at all on
|
| 11 | some systems (such as GNU Hurd). There is however a limit on
|
| 12 | sizeof(struct sockaddr_un.sun_path), so use it.
|
| 13 |
|
| 14 | Signed-off-by: Samuel Thibault <[email protected]>
|
| 15 | Part-of: <https://gitlab.freedesktop.org/xorg/lib/libxcb/-/merge_requests/65>
|
| 16 | ---
|
| 17 | src/xcb_util.c | 4 +++-
|
| 18 | 1 file changed, 3 insertions(+), 1 deletion(-)
|
| 19 |
|
| 20 | diff --git a/src/xcb_util.c b/src/xcb_util.c
|
| 21 | index 5124d14..017583e 100644
|
| 22 | |
| 23 | |
| 24 | @@ -104,7 +104,9 @@ static int _xcb_parse_display_path_to_socket(const char *name, char **host, char
|
| 25 | int *displayp, int *screenp)
|
| 26 | {
|
| 27 | struct stat sbuf;
|
| 28 | - char path[PATH_MAX];
|
| 29 | + /* In addition to the AF_UNIX path, there may be a screen number.
|
| 30 | + * The trailing \0 is already accounted in the size of sun_path. */
|
| 31 | + char path[sizeof(((struct sockaddr_un*)0)->sun_path) + 1 + 10];
|
| 32 | size_t len;
|
| 33 | int _screen = 0, res;
|
| 34 |
|
| 35 | --
|
| 36 | GitLab
|
| 37 |
|