git.samba.org
/
obnox
/
samba
/
samba-obnox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
9620791
)
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
Stefan Metzmacher
<metze@samba.org>
Thu, 24 Dec 2009 16:38:04 +0000
(17:38 +0100)
This is needed as getpeername() truncates the length to 2 if the
peer socket has no name.
metze
lib/tsocket/tsocket_bsd.c
patch
|
blob
|
history
diff --git
a/lib/tsocket/tsocket_bsd.c
b/lib/tsocket/tsocket_bsd.c
index 1c1e58099bf0503a19b0c83e91504af0f20fb0ee..22393bf02f1f07f16b49a9517ffbce77cafa2eeb 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)) {