Skip to content

Commit 3473b51

Browse files
committed
fix datatype for zpp, yet a followup on bug #73679
1 parent ee2625e commit 3473b51

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

ext/com_dotnet/com_com.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,30 @@ PHP_FUNCTION(com_create_instance)
5252
RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE,
5353
&authid, EOAC_NONE
5454
};
55+
zend_long cp = CP_ACP;
5556

5657
php_com_initialize();
5758
obj = CDNO_FETCH(object);
5859

5960
if (FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
6061
ZEND_NUM_ARGS(), "s|s!ls",
6162
&module_name, &module_name_len, &server_name, &server_name_len,
62-
&obj->code_page, &typelib_name, &typelib_name_len) &&
63+
&cp, &typelib_name, &typelib_name_len) &&
6364
FAILURE == zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET,
6465
ZEND_NUM_ARGS(), "sa|ls",
65-
&module_name, &module_name_len, &server_params, &obj->code_page,
66+
&module_name, &module_name_len, &server_params, &cp,
6667
&typelib_name, &typelib_name_len)) {
6768

6869
php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid arguments!");
6970
return;
7071
}
7172

73+
if (Z_L(0) > cp || ZEND_LONG_INT_OVFL(cp)) {
74+
php_com_throw_exception(E_INVALIDARG, "Could not create COM object - invalid codepage!");
75+
return;
76+
}
77+
obj->code_page = (int)cp;
78+
7279
if (server_name) {
7380
ctx = CLSCTX_REMOTE_SERVER;
7481
} else if (server_params) {

0 commit comments

Comments
 (0)