summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichal Schmidt <mschmidt@redhat.com>2015-02-20 02:25:16 +0100
committerMichal Schmidt <mschmidt@redhat.com>2015-02-20 03:35:12 +0100
commit710708a54ccc48e168ad7d4cd401645ef9e2eb14 (patch)
tree849f7fe4b0f5b8a599d07520ba1101843df946b0 /src
parent02233928a502e46fc125118dba7234ba3e48dc15 (diff)
shared: handle unnamed sockets in socket_address_equal()
Make sure we don't inspect sun_path of unnamed sockets. Since we cannot know if two unnamed sockets' adresses refer to the same socket, just return false.
Diffstat (limited to 'src')
-rw-r--r--src/shared/socket-util.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
index deecce8a80..a4e26b1d8c 100644
--- a/src/shared/socket-util.c
+++ b/src/shared/socket-util.c
@@ -349,6 +349,10 @@ bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) {
break;
case AF_UNIX:
+ if (a->size <= offsetof(struct sockaddr_un, sun_path) ||
+ b->size <= offsetof(struct sockaddr_un, sun_path))
+ return false;
+
if ((a->sockaddr.un.sun_path[0] == 0) != (b->sockaddr.un.sun_path[0] == 0))
return false;