[master] 105e2b306 Check for the empty abstract socket name
Nils Goroll
nils.goroll at uplex.de
Mon Nov 21 17:11:05 UTC 2022
commit 105e2b3064ac9a397a1c75e9e48a4623094b4c38
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Mon Nov 21 17:15:29 2022 +0100
Check for the empty abstract socket name
As pointed out by Dridi, we should rather not make an attempt to
support un-printable socket names, of which the empty name is
the most prominent case.
For all other non-printable cases (e.g. d\0r\0i\0d\0i), we have
no support to pass them in the first place, because we treat
uds paths as NUL-terminated strings.
diff --git a/lib/libvarnish/vus.c b/lib/libvarnish/vus.c
index f1b943649..c9920ef28 100644
--- a/lib/libvarnish/vus.c
+++ b/lib/libvarnish/vus.c
@@ -57,6 +57,13 @@ sun_init(struct sockaddr_un *uds, const char *path, const char **err)
*err = "Path too long for a Unix domain socket";
return (-1);
}
+ if (! strcmp(path, "@")) {
+ errno = EINVAL;
+ if (err)
+ *err = "The empty abstract socket name is not"
+ " supported";
+ return (-1);
+ }
memset(uds->sun_path, 0, sizeof(uds->sun_path));
if (*path == '@')
bprintf(uds->sun_path, "%c%s", 0, path + 1);
More information about the varnish-commit
mailing list