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:
parent
d005e45254
commit
820e374169
|
@ -107,6 +107,9 @@ static int _xcb_parse_display_path_to_socket(const char *name, char **host, char
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
int _screen = 0;
|
int _screen = 0;
|
||||||
|
|
||||||
|
if (name[0] != '/')
|
||||||
|
return 0;
|
||||||
|
|
||||||
xcb_strlcpy(path, name, sizeof(path));
|
xcb_strlcpy(path, name, sizeof(path));
|
||||||
if (0 != stat(path, &sbuf)) {
|
if (0 != stat(path, &sbuf)) {
|
||||||
char *dot = strrchr(path, '.');
|
char *dot = strrchr(path, '.');
|
||||||
|
|
Loading…
Reference in New Issue