chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
0223392
)
shared: handle unnamed sockets in socket_address_equal()
author
Michal Schmidt
<mschmidt@redhat.com>
Fri, 20 Feb 2015 01:25:16 +0000
(
02:25
+0100)
committer
Michal Schmidt
<mschmidt@redhat.com>
Fri, 20 Feb 2015 02:35:12 +0000
(
03:35
+0100)
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.
src/shared/socket-util.c
patch
|
blob
|
history
diff --git
a/src/shared/socket-util.c
b/src/shared/socket-util.c
index deecce8a8062da84ead7ec973323d0364ea8e84b..a4e26b1d8c0065525cac4943a6a8a680621a6a54 100644
(file)
--- 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;