|
Zbigniew Jędrzejewski-Szmek |
399a2a |
From 04691e6f814b76ea497d8189b9b77d4c0feff794 Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
From: Michal Schmidt <mschmidt@redhat.com>
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
Date: Fri, 20 Feb 2015 02:25:16 +0100
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
Subject: [PATCH] shared: handle unnamed sockets in socket_address_equal()
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
Make sure we don't inspect sun_path of unnamed sockets.
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
Since we cannot know if two unnamed sockets' adresses refer to the same
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
socket, just return false.
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
(cherry picked from commit 710708a54ccc48e168ad7d4cd401645ef9e2eb14)
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
---
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
src/shared/socket-util.c | 4 ++++
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
1 file changed, 4 insertions(+)
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
diff --git a/src/shared/socket-util.c b/src/shared/socket-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
index deecce8a80..a4e26b1d8c 100644
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
--- a/src/shared/socket-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+++ b/src/shared/socket-util.c
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
@@ -349,6 +349,10 @@ bool socket_address_equal(const SocketAddress *a, const SocketAddress *b) {
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
break;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
case AF_UNIX:
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+ if (a->size <= offsetof(struct sockaddr_un, sun_path) ||
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+ b->size <= offsetof(struct sockaddr_un, sun_path))
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+ return false;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
+
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
if ((a->sockaddr.un.sun_path[0] == 0) != (b->sockaddr.un.sun_path[0] == 0))
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
return false;
|
|
Zbigniew Jędrzejewski-Szmek |
399a2a |
|