summaryrefslogtreecommitdiffhomepage
path: root/src/socket
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket')
-rw-r--r--src/socket/ntapi_sc_socket_v1.c14
-rw-r--r--src/socket/ntapi_sc_socket_v2.c14
2 files changed, 24 insertions, 4 deletions
diff --git a/src/socket/ntapi_sc_socket_v1.c b/src/socket/ntapi_sc_socket_v1.c
index c9b4519..e4752a4 100644
--- a/src/socket/ntapi_sc_socket_v1.c
+++ b/src/socket/ntapi_sc_socket_v1.c
@@ -39,6 +39,8 @@ int32_t __cdecl __ntapi_sc_socket_v1(
nt_sqos ssqos;
nt_unicode_string nt_afdep;
uint32_t ea_length;
+ uint16_t sdomain;
+ uint16_t stype;
void * _hsocket;
wchar16_t afd_end_point[] = {
@@ -47,6 +49,11 @@ int32_t __cdecl __ntapi_sc_socket_v1(
'\\','E','n','d','P','o','i','n','t',
0};
+ if (domain >= 0x10000)
+ return NT_STATUS_INVALID_PARAMETER_2;
+ else if (type > 0x10000)
+ return NT_STATUS_INVALID_PARAMETER_3;
+
/* tcp as default extended attribute */
nt_afd_socket_ea afd_ea = {
0,
@@ -103,11 +110,14 @@ int32_t __cdecl __ntapi_sc_socket_v1(
oa.obj_name = 0;
oa.obj_attr = 0;
+ sdomain = (uint16_t)domain;
+ stype = (uint16_t)type;
+
if (status == NT_STATUS_SUCCESS) {
hssocket->hsocket = _hsocket;
hssocket->ntflags = 0;
- hssocket->domain = domain;
- hssocket->type = type;
+ hssocket->domain = sdomain;
+ hssocket->type = stype;
hssocket->protocol = protocol;
hssocket->timeout.quad = 0;
hssocket->iostatus = NT_STATUS_SUCCESS;
diff --git a/src/socket/ntapi_sc_socket_v2.c b/src/socket/ntapi_sc_socket_v2.c
index 2fc30e5..5b1493c 100644
--- a/src/socket/ntapi_sc_socket_v2.c
+++ b/src/socket/ntapi_sc_socket_v2.c
@@ -44,6 +44,8 @@ int32_t __cdecl __ntapi_sc_socket_v2(
nt_sqos ssqos;
nt_unicode_string nt_afdep;
uint32_t ea_length;
+ uint16_t sdomain;
+ uint16_t stype;
void * _hsocket;
wchar16_t afd_end_point[] = {
@@ -61,6 +63,11 @@ int32_t __cdecl __ntapi_sc_socket_v2(
{0,0,0,0,0},
{0}};
+ if (domain >= 0x10000)
+ return NT_STATUS_INVALID_PARAMETER_2;
+ else if (type > 0x10000)
+ return NT_STATUS_INVALID_PARAMETER_3;
+
ea_length = sizeof(afd_ea);
afd_ea.sattr.domain = domain;
@@ -111,10 +118,13 @@ int32_t __cdecl __ntapi_sc_socket_v2(
oa.obj_name = 0;
oa.obj_attr = 0;
+ sdomain = (uint16_t)domain;
+ stype = (uint16_t)type;
+
hssocket->hsocket = _hsocket;
hssocket->ntflags = 0;
- hssocket->domain = domain;
- hssocket->type = type;
+ hssocket->domain = sdomain;
+ hssocket->type = stype;
hssocket->protocol = protocol;
hssocket->timeout.quad = 0;
hssocket->iostatus = NT_STATUS_SUCCESS;