summaryrefslogtreecommitdiffhomepage
path: root/src/socket
diff options
context:
space:
mode:
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;