Blame SOURCES/0049-shared-handle-unnamed-sockets-in-socket_address_equa.patch

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