From: Zbigniew Jędrzejewski-Szmek Date: Wed, 9 Sep 2020 21:57:59 +0000 (+0200) Subject: Minor simplification in sockaddr_un_set_path() X-Git-Tag: v247-rc1~261^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F16947%2Fhead;p=thirdparty%2Fsystemd.git Minor simplification in sockaddr_un_set_path() --- 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