summaryrefslogtreecommitdiffhomepage
path: root/src/socket
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-06-14 13:03:32 -0400
committermidipix <writeonce@midipix.org>2016-06-14 13:29:29 -0400
commitf34a581ad421ef112a5f2cb9da12fa15693e2156 (patch)
tree8eaacf14c27987329cbe7886fbdc0b7ef34029a2 /src/socket
parentc308d4de85a37a85b2c99b75bb6ec0df5fbc4376 (diff)
downloadntapi-f34a581ad421ef112a5f2cb9da12fa15693e2156.tar.bz2
ntapi-f34a581ad421ef112a5f2cb9da12fa15693e2156.tar.xz
__ntapi_sc_bind_v2(): fix handling of ipv6 addresses.
Diffstat (limited to 'src/socket')
-rw-r--r--src/socket/ntapi_sc_bind_v2.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/socket/ntapi_sc_bind_v2.c b/src/socket/ntapi_sc_bind_v2.c
index 92d14b6..7be603f 100644
--- a/src/socket/ntapi_sc_bind_v2.c
+++ b/src/socket/ntapi_sc_bind_v2.c
@@ -21,9 +21,9 @@ typedef struct _nt_afd_bind_reply {
} nt_afd_bind_reply;
typedef struct __addr_memcpy {
- uint32_t d0;
- uint32_t d1;
- uint32_t d2;
+ uint64_t d0;
+ uint64_t d1;
+ uint64_t d2;
uint32_t d3;
} _addr_memcpy;
@@ -43,9 +43,12 @@ int32_t __cdecl __ntapi_sc_bind_v2(
_addr_memcpy * src;
_addr_memcpy * dst;
- (void)addrlen;
(void)service_flags;
+ if ((addrlen != sizeof(nt_sockaddr_in4))
+ && (addrlen != sizeof(nt_sockaddr_in6)))
+ return NT_STATUS_INVALID_PARAMETER_3;
+
iosb = iosb ? iosb : &siosb;
/* request */
@@ -56,8 +59,14 @@ int32_t __cdecl __ntapi_sc_bind_v2(
dst->d0 = src->d0;
dst->d1 = src->d1;
- dst->d2 = src->d2;
- dst->d3 = src->d3;
+
+ if (addrlen == sizeof(nt_sockaddr_in6)) {
+ dst->d2 = src->d2;
+ dst->d3 = src->d3;
+ } else {
+ dst->d2 = 0;
+ dst->d3 = 0;
+ }
hssocket->iostatus = __ntapi->zw_device_io_control_file(
hssocket->hsocket,
@@ -80,8 +89,11 @@ int32_t __cdecl __ntapi_sc_bind_v2(
dst->d0 = src->d0;
dst->d1 = src->d1;
- dst->d2 = src->d2;
- dst->d3 = src->d3;
+
+ if (addrlen == sizeof(nt_sockaddr_in6)) {
+ dst->d2 = src->d2;
+ dst->d3 = src->d3;
+ }
}
return hssocket->iostatus;