Require path-based socket names to start with leading '/'

This avoids connecting to paths which happen to match other display
names, like ':0'.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2020-11-16 11:37:26 -08:00
parent d005e45254
commit 820e374169

View File

@ -107,6 +107,9 @@ static int _xcb_parse_display_path_to_socket(const char *name, char **host, char
char path[PATH_MAX];
int _screen = 0;
if (name[0] != '/')
return 0;
xcb_strlcpy(path, name, sizeof(path));
if (0 != stat(path, &sbuf)) {
char *dot = strrchr(path, '.');