git.samba.org
/
samba.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2975e65
)
tsocket: allow AF_UNIX sockaddrs smaller than sizeof(sockaddr_un)
author
Stefan Metzmacher
<metze@samba.org>
Wed, 23 Dec 2009 18:31:41 +0000
(19:31 +0100)
committer
Karolin Seeger
<kseeger@samba.org>
Mon, 17 May 2010 07:50:19 +0000
(09:50 +0200)
This is needed as getpeername() truncates the length to 2 if the
peer socket has no name.
metze
(cherry picked from commit
4784c8c3bea98592486ca973d57c99671eb68cb2
)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
(cherry picked from commit
e9f7d271e2a96d5dbce63bc454c68930cbc52d62
)
lib/tsocket/tsocket_bsd.c
patch
|
blob
|
history
diff --git
a/lib/tsocket/tsocket_bsd.c
b/lib/tsocket/tsocket_bsd.c
index 201788e9223b3b9ffc807485f458180fc46a2a51..6f6b4229f9f8cc632daeb2d460e867f13f20258b 100644
(file)
--- a/
lib/tsocket/tsocket_bsd.c
+++ b/
lib/tsocket/tsocket_bsd.c
@@
-210,12
+210,13
@@
int _tsocket_address_bsd_from_sockaddr(TALLOC_CTX *mem_ctx,
struct tsocket_address *addr;
struct tsocket_address_bsd *bsda;
+ if (sa_socklen < sizeof(sa->sa_family)) {
+ errno = EINVAL;
+ return -1;
+ }
+
switch (sa->sa_family) {
case AF_UNIX:
- if (sa_socklen < sizeof(struct sockaddr_un)) {
- errno = EINVAL;
- return -1;
- }
break;
case AF_INET:
if (sa_socklen < sizeof(struct sockaddr_in)) {