summaryrefslogtreecommitdiffhomepage
path: root/src/socket/ntapi_sc_socket_v1.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/socket/ntapi_sc_socket_v1.c')
-rw-r--r--src/socket/ntapi_sc_socket_v1.c14
1 files changed, 12 insertions, 2 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;