summaryrefslogtreecommitdiff
path: root/src/basic/socket-util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2018-10-15 13:55:48 +0200
committerLennart Poettering <lennart@poettering.net>2018-10-15 19:35:00 +0200
commit057e85805c2ca7440884f457dcd30a4261fb4619 (patch)
tree7f9d7e4d3c91469995a7c571d090b73c17304173 /src/basic/socket-util.c
parent9ec30b27694f83442ca73d98cc149fdb151f67c4 (diff)
downloadsystemd-057e85805c2ca7440884f457dcd30a4261fb4619.tar.gz
socket-address: document socket address parsing size restrictions in a comment
Diffstat (limited to 'src/basic/socket-util.c')
-rw-r--r--src/basic/socket-util.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/basic/socket-util.c b/src/basic/socket-util.c
index 47c2de8b6d..aa636ffd61 100644
--- a/src/basic/socket-util.c
+++ b/src/basic/socket-util.c
@@ -97,7 +97,9 @@ int socket_address_parse(SocketAddress *a, const char *s) {
size_t l;
l = strlen(s);
- if (l >= sizeof(a->sockaddr.un.sun_path))
+ if (l >= sizeof(a->sockaddr.un.sun_path)) /* Note that we refuse non-NUL-terminated sockets when
+ * parsing (the kernel itself is less strict here in what it
+ * accepts) */
return -EINVAL;
a->sockaddr.un.sun_family = AF_UNIX;
@@ -109,7 +111,11 @@ int socket_address_parse(SocketAddress *a, const char *s) {
size_t l;
l = strlen(s+1);
- if (l >= sizeof(a->sockaddr.un.sun_path) - 1)
+ if (l >= sizeof(a->sockaddr.un.sun_path) - 1) /* Note that we refuse non-NUL-terminate sockets here
+ * when parsing, even though abstract namespace sockets
+ * explicitly allow embedded NUL bytes and don't consider
+ * them special. But it's simply annoying to debug such
+ * sockets. */
return -EINVAL;
a->sockaddr.un.sun_family = AF_UNIX;