From c097bf1f50af525fd5cfb0ae7ee9d62fbcb1ca58 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 9 Sep 2020 23:57:59 +0200 Subject: [PATCH] Minor simplification in sockaddr_un_set_path() --- src/basic/socket-util.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c index 85edc83cae3..7a3299672ab 100644 --- a/src/basic/socket-util.c +++ b/src/basic/socket-util.c @@ -1118,12 +1118,10 @@ int sockaddr_un_set_path(struct sockaddr_un *ret, const char *path) { * reference paths in the abstract namespace that include NUL bytes in the name. */ l = strlen(path); - if (l == 0) + if (l < 2) return -EINVAL; if (!IN_SET(path[0], '/', '@')) return -EINVAL; - if (path[1] == 0) - return -EINVAL; /* Don't allow paths larger than the space in sockaddr_un. Note that we are a tiny bit more restrictive than * the kernel is: we insist on NUL termination (both for abstract namespace and regular file system socket -- 2.47.3