[PATCH] - 64 bit issue with zend_parse_parameters calls

[email protected] (Dave Hill)
Newsgroups php.dev
Message-ID <[email protected]>
Hi all, I am back again....

Diff against php4-STABLE-200302241430
    (without the last patch I suggested)
Applies to 4.5.x and 5.x as well.
Affects any 64 bit OS.

I ran into another problem after I turned optimization back on. Usually
these are hell to find, but Julien Soula (who I met through the
bug database) had encountered this already.

This time I have a 64 bit issue with zend_parse_parameters().
Luckily the problem is not the implementation, rather the usage.

"s" -> needs a char *, int *
"l" -> needs a long *

Passing the wrong type into this function will have .... unexpected
results... :-) In my case I was getting string lengths with random
values in the upper 32 bits making for strings a bit longer than
in reality.

I did a code inspection (helped by cscope) of the 480 hits,
checking what the types were passed for s & l entries. I did this
regardless of if I actually use the code - it was just easier to
look at them all, but this does mean that I will not be compile
testing all of them.... I have 26 changed files. I hope the
diff will work against 4.5.x and later because that was a lot of
files to inspect :-p

Where a type like size_t or an enum was used, I converted this to
a long. I did this because the function is defined as taking a
long, and in some cases (like enum) you may actually be getting
an int. Even in a case like size_t where you are probablly safe,
I have always found it to be safe then sorry.

Interestingly enough I did find one coding error, in
ext/w32api/w32api.c there are two calls with "s|l" and only
two arguments passed into the function, so heaven help anyone
who tries to pass that optional long :-) I guess it is lucky
that I am using Apache/Unix :-)

Per README.SUBMITTING_PATCH I am trying to copy all
of the extension owners.

Files affected:
    ./ext/domxml/php_domxml.c
    ./ext/fdf/fdf.c
    ./ext/ftp/php_ftp.c
    ./ext/ldap/ldap.c
    ./ext/mcrypt/mcrypt.c
    ./ext/mhash/mhash.c
    ./ext/pgsql/pgsql.c
    ./ext/posix/posix.c
    ./ext/dio/dio.c
    ./ext/sockets/sockets.c
    ./ext/standard/exec.c
    ./ext/standard/file.c
    ./ext/standard/fsock.c
    ./ext/standard/head.c
    ./ext/standard/html.c
    ./ext/standard/metaphone.c
    ./ext/standard/string.c
    ./ext/sysvsem/sysvsem.c
    ./ext/zlib/zlib.c
    ./ext/bz2/bz2.c
    ./ext/openssl/openssl.c
    ./ext/rpc/com/com.c
    ./ext/iconv/iconv.c
    ./ext/mbstring/mbstring.c
    ./ext/mbstring/php_mbregex.c
    ./ext/zip/zip.c
    ./main/output.c
mod2u-diff.txt (text/plain, 31.1 KB)
--- php4-STABLE-200302241430/./ext/domxml/php_domxml.c	2003-01-10 13:11:03.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/domxml/php_domxml.c	2003-03-01 14:24:23.000000000 -0500
@@ -1967,7 +1967,8 @@
 	zval *rv = NULL;
 	zval *id;
 	xmlNode *n, *node;
-	int ret, recursive = 0;;
+	int ret; 
+	long recursive = 0;
 
 	DOMXML_GET_THIS_OBJ(n, id, le_domxmlnodep);
 
@@ -3558,7 +3559,8 @@
 	zval *arg1, *id, *rv = NULL;
 	xmlNodePtr node, srcnode;
 	xmlDocPtr docp;
-	int ret, recursive = 0;
+	int ret; 
+	long recursive = 0;
 
 	DOMXML_GET_THIS_OBJ(docp, id, le_domxmldocp);
 
@@ -3764,7 +3766,8 @@
 	int ret; 
 	char *buffer;
 	int buffer_len;
-	int mode = 0, prevSubstValue;
+	long mode = 0;
+	int prevSubstValue;
 	int oldvalue =  xmlDoValidityCheckingDefaultValue;
 	int oldvalue_keepblanks;
  	int prevLoadExtDtdValue = xmlLoadExtDtdDefaultValue;
@@ -3850,7 +3853,8 @@
 	xmlDoc *docp = NULL;
 	int ret, file_len;
 	char *file;
-	int mode = 0, prevSubstValue;
+	long mode = 0;
+	int prevSubstValue;
 	int oldvalue =  xmlDoValidityCheckingDefaultValue;
 	int oldvalue_keepblanks;
 	zval *errors = NULL;
@@ -5211,7 +5215,8 @@
 	xmlDocPtr xmldocp;
 	char *filename;
 	int filename_len;
-	int ret, compression = 0;
+	int ret;
+	long compression = 0;
 
 	DOMXML_GET_THIS(idxsl);
 
--- php4-STABLE-200302241430/./ext/fdf/fdf.c	2002-12-31 12:15:19.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/fdf/fdf.c	2003-03-01 14:24:23.000000000 -0500
@@ -554,7 +554,8 @@
 PHP_FUNCTION(fdf_get_ap) {
 	zval *r_fdf;
 	char *fieldname, *filename;
-	int fieldname_len, filename_len, face;
+	int fieldname_len, filename_len;
+	long face;
 	FDFDoc fdf;
 	FDFErc err;
 	FDFAppFace facenr;
@@ -941,7 +942,8 @@
 PHP_FUNCTION(fdf_get_flags) {
  	zval *r_fdf;
 	char *fieldname;
-	int fieldname_len, whichflags;
+	int fieldname_len;
+	long whichflags;
 	FDFDoc fdf;
 	FDFErc err;
 	ASUns32 flags;
@@ -997,7 +999,8 @@
 PHP_FUNCTION(fdf_get_opt) {
  	zval *r_fdf;
 	char *fieldname;
-	int fieldname_len, element = -1;
+	int fieldname_len;
+	long element = -1;
 	FDFDoc fdf;
 	FDFErc err;
 
--- php4-STABLE-200302241430/./ext/ftp/php_ftp.c	2003-01-06 23:09:26.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/ftp/php_ftp.c	2003-03-01 14:24:23.000000000 -0500
@@ -145,7 +145,8 @@
 {
 	ftpbuf_t	*ftp;
 	char		*host;
-	int			host_len, port = 0;
+	int		host_len;
+	long 		port = 0;
 	long		timeout_sec = FTP_DEFAULT_TIMEOUT;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) {
@@ -181,7 +182,8 @@
 {
 	ftpbuf_t	*ftp;
 	char		*host;
-	int			host_len, port = 0;
+	int		host_len;
+	long		port = 0;
 	long		timeout_sec = FTP_DEFAULT_TIMEOUT;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ll", &host, &host_len, &port, &timeout_sec) == FAILURE) {
@@ -467,7 +469,8 @@
 	ftptype_t	xtype;
 	php_stream	*stream;
 	char		*file;
-	int			file_len, mode, resumepos=0;
+	int		file_len;
+	long 		mode, resumepos=0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
 		return;
@@ -510,7 +513,8 @@
 	ftptype_t	xtype;
 	php_stream	*stream;
 	char		*file;
-	int			file_len, mode, resumepos=0, ret;
+	int		file_len, ret;
+	long		mode, resumepos=0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrsl|l", &z_ftp, &z_file, &file, &file_len, &mode, &resumepos) == FAILURE) {
 		return;
@@ -579,7 +583,8 @@
 	ftptype_t	xtype;
 	php_stream	*outstream;
 	char		*local, *remote;
-	int			local_len, remote_len, mode, resumepos=0;
+	int		local_len, remote_len;
+	long		mode, resumepos=0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
 		return;
@@ -636,7 +641,8 @@
 	ftptype_t	xtype;
 	php_stream	*outstream;
 	char		*local, *remote;
-	int			local_len, remote_len, mode, resumepos=0, ret;
+	int		local_len, remote_len, ret;
+	long		mode, resumepos=0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &local, &local_len, &remote, &remote_len, &mode, &resumepos) == FAILURE) {
 		return;
@@ -735,7 +741,8 @@
 	zval		*z_ftp, *z_file;
 	ftpbuf_t	*ftp;
 	ftptype_t	xtype;
-	int			mode, remote_len, startpos=0;
+	int		remote_len;
+	long		mode, startpos=0;
 	php_stream	*stream;
 	char		*remote;
 
@@ -781,7 +788,8 @@
 	zval		*z_ftp, *z_file;
 	ftpbuf_t	*ftp;
 	ftptype_t	xtype;
-	int			mode, remote_len, startpos=0, ret;
+	int		remote_len, ret;
+	long		mode, startpos=0;
 	php_stream	*stream;
 	char		*remote;
 
@@ -833,7 +841,8 @@
 	ftpbuf_t	*ftp;
 	ftptype_t	xtype;
 	char		*remote, *local;
-	int			remote_len, local_len, mode, startpos=0;
+	int		remote_len, local_len;
+	long		mode, startpos=0;
 	php_stream * instream;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
@@ -887,7 +896,8 @@
 	ftpbuf_t	*ftp;
 	ftptype_t	xtype;
 	char		*remote, *local;
-	int			remote_len, local_len, mode, startpos=0, ret;
+	int		remote_len, local_len, ret;
+	int		mode, startpos=0;
 	php_stream * instream;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rssl|l", &z_ftp, &remote, &remote_len, &local, &local_len, &mode, &startpos) == FAILURE) {
--- php4-STABLE-200302241430/./ext/ldap/ldap.c	2002-12-31 12:15:19.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/ldap/ldap.c	2003-03-01 14:24:23.000000000 -0500
@@ -345,11 +345,11 @@
 {
 	char *host = NULL;
 	int hostlen;
-	int port = 389; /* Default port */
+	long port = 389; /* Default port */
 #ifdef HAVE_ORALDAP
 	char *wallet, *walletpasswd;
 	int walletlen, walletpasswdlen;
-	int authmode;
+	long authmode;
 	int ssl=0;
 #endif
 	ldap_linkdata *ld;
--- php4-STABLE-200302241430/./ext/mcrypt/mcrypt.c	2002-12-31 12:15:19.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/mcrypt/mcrypt.c	2003-03-01 14:24:23.000000000 -0500
@@ -1435,7 +1435,7 @@
 PHP_FUNCTION(mcrypt_create_iv)
 {
 	char *iv;
-	iv_source source = RANDOM;
+	long source = RANDOM;
 	long size;
 	int n = 0;
 
--- php4-STABLE-200302241430/./ext/mhash/mhash.c	2003-02-23 23:13:07.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/mhash/mhash.c	2003-03-01 14:24:23.000000000 -0500
@@ -107,7 +107,7 @@
    Gets the block size of hash */
 PHP_FUNCTION(mhash_get_block_size)
 {
-	int hash;
+	long hash;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash) == FAILURE) {
 		WRONG_PARAM_COUNT;
@@ -123,7 +123,7 @@
 PHP_FUNCTION(mhash_get_hash_name)
 {
 	char *name;
-	int hash;
+	long hash;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &hash) == FAILURE) {
 		WRONG_PARAM_COUNT;
@@ -147,7 +147,7 @@
 	MHASH td;
 	int bsize;
 	unsigned char *hash_data;
-	int hash;
+	long hash;
 	int data_len, key_len=0;
 	char *data, *key=NULL;
 	
@@ -196,7 +196,7 @@
 {
 	KEYGEN keystruct;
 	char salt[SALT_SIZE], *ret;
-	int hash, bytes;
+	long hash, bytes;
 	char *password, *in_salt;
 	int password_len, salt_len;
 	
--- php4-STABLE-200302241430/./ext/pgsql/pgsql.c	2003-02-20 03:12:02.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/pgsql/pgsql.c	2003-03-01 14:24:23.000000000 -0500
@@ -1439,7 +1439,7 @@
 PHP_FUNCTION(pg_result_seek)
 {
 	zval *result;
-	int row;
+	long row;
 	pgsql_result_handle *pg_result;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &result, &row) == FAILURE) {
@@ -2190,7 +2190,7 @@
 PHP_FUNCTION(pg_lo_seek)
 {
 	zval *pgsql_id = NULL;
-	int offset = 0, whence = SEEK_CUR;
+	long offset = 0, whence = SEEK_CUR;
 	pgLofp *pgsql;
 	int argc = ZEND_NUM_ARGS();
 
@@ -2601,7 +2601,8 @@
 PHP_FUNCTION(pg_escape_string)
 {
 	char *from = NULL, *to = NULL;
-	size_t from_len, to_len;
+	size_t to_len;
+	long from_len;
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
 							  &from, &from_len) == FAILURE) {
 		return;
@@ -2618,7 +2619,8 @@
 PHP_FUNCTION(pg_escape_bytea)
 {
 	char *from = NULL, *to = NULL;
-	size_t from_len, to_len;
+	size_t to_len;
+	long from_len;
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
 							  &from, &from_len) == FAILURE) {
 		return;
@@ -2741,7 +2743,8 @@
 PHP_FUNCTION(pg_unescape_bytea)
 {
 	char *from = NULL, *to = NULL;
-	size_t from_len, to_len;
+	size_t to_len;
+	long from_len;
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s",
 							  &from, &from_len) == FAILURE) {
 		return;
@@ -3917,7 +3920,7 @@
 {
 	zval *pgsql_link, *values;
 	char *table_name;
-	size_t table_name_len;
+	int table_name_len;
 	ulong option = 0;
 	PGconn *pg_link;
 	int id = -1;
@@ -4076,7 +4079,7 @@
 {
 	zval *pgsql_link, *values;
 	char *table, *sql = NULL;
-	ulong table_len;
+	int table_len;
 	ulong option = PGSQL_DML_EXEC;
 	PGconn *pg_link;
 	int id = -1, argc = ZEND_NUM_ARGS();
@@ -4225,7 +4228,7 @@
 {
 	zval *pgsql_link, *values, *ids;
 	char *table, *sql = NULL;
-	ulong table_len;
+	int table_len;
 	ulong option =  PGSQL_DML_EXEC;
 	PGconn *pg_link;
 	int id = -1, argc = ZEND_NUM_ARGS();
@@ -4314,7 +4317,8 @@
 {
 	zval *pgsql_link, *ids;
 	char *table, *sql = NULL;
-	ulong table_len, option = PGSQL_DML_EXEC;
+	int table_len;
+	ulong option = PGSQL_DML_EXEC;
 	PGconn *pg_link;
 	int id = -1, argc = ZEND_NUM_ARGS();
 
@@ -4451,7 +4455,8 @@
 {
 	zval *pgsql_link, *ids;
 	char *table, *sql = NULL;
-	ulong table_len, option = PGSQL_DML_EXEC;
+	int table_len;
+	ulong option = PGSQL_DML_EXEC;
 	PGconn *pg_link;
 	int id = -1, argc = ZEND_NUM_ARGS();
 
--- php4-STABLE-200302241430/./ext/posix/posix.c	2002-12-31 12:15:20.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/posix/posix.c	2003-03-01 14:24:23.000000000 -0500
@@ -702,7 +702,8 @@
 PHP_FUNCTION(posix_mkfifo)
 {
 	char *path;
-	long path_len, mode;
+	int path_len;
+	long mode;
 	int     result;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl", &path, &path_len, &mode) == FAILURE)
--- php4-STABLE-200302241430/./ext/dio/dio.c	2002-12-31 12:15:19.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/dio/dio.c	2003-03-01 14:24:24.000000000 -0500
@@ -146,8 +146,8 @@
 	php_fd_t *f;
 	char     *file_name;
 	int       file_name_length;
-	int       flags;
-	mode_t    mode = 0;
+	long      flags;
+	long      mode = 0;
 	int       fd;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) {
@@ -178,7 +178,7 @@
 	zval     *r_fd;
 	php_fd_t *f;
 	char     *data;
-	int       bytes = 1024;
+	long      bytes = 1024;
 	ssize_t   res;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &r_fd, &bytes) == FAILURE) {
@@ -207,8 +207,8 @@
 	zval     *r_fd;
 	php_fd_t *f;
 	char     *data;
-	size_t    data_len;
-	size_t    trunc_len = 0;
+	int       data_len;
+	long      trunc_len = 0;
 	ssize_t   res;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) {
@@ -232,7 +232,7 @@
 {
 	zval     *r_fd;
 	php_fd_t *f;
-	off_t     offset;
+	long      offset;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &r_fd, &offset) == FAILURE) {
 		return;
@@ -293,8 +293,8 @@
 {
 	zval     *r_fd;
 	php_fd_t *f;
-	off_t     offset;
-	int       whence = SEEK_SET;
+	long      offset;
+	long      whence = SEEK_SET;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &r_fd, &offset, &whence) == FAILURE) {
 		return;
@@ -312,7 +312,7 @@
 	zval     *r_fd;
 	zval     *arg = NULL;
 	php_fd_t *f;
-	int       cmd;
+	long      cmd;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &r_fd, &cmd, &arg) == FAILURE) {
 		return;
--- php4-STABLE-200302241430/./ext/sockets/sockets.c	2002-12-31 12:15:21.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/sockets/sockets.c	2003-03-01 14:24:24.000000000 -0500
@@ -555,7 +555,8 @@
 	struct timeval *tv_p = NULL;
 	fd_set			rfds, wfds, efds;
 	SOCKET			max_fd = 0;
-	int				retval, sets = 0, usec = 0;
+	int			retval, sets = 0;
+	long			usec = 0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
 		return;
@@ -602,7 +603,7 @@
 PHP_FUNCTION(socket_create_listen)
 {
 	php_socket	*php_sock;
-	int			port, backlog = 128;
+	long		port, backlog = 128;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|l", &port, &backlog) == FAILURE)
 		return;
@@ -702,7 +703,7 @@
 {
 	zval		*arg1;
 	php_socket	*php_sock;
-	int			backlog = 0;
+	long			backlog = 0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &backlog) == FAILURE)
 		return;
@@ -739,7 +740,8 @@
 {
 	zval		*arg1;
 	php_socket	*php_sock;
-	int			retval, str_len, length;
+	int			retval, str_len;
+	long			length;
 	char		*str;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &str, &str_len, &length) == FAILURE)
@@ -773,7 +775,8 @@
 	zval		*arg1;
 	php_socket	*php_sock;
 	char		*tmpbuf;
-	int			retval, length, type = PHP_BINARY_READ;
+	int			retval;
+	long			length, type = PHP_BINARY_READ;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &arg1, &length, &type) == FAILURE)
 		return;
@@ -920,7 +923,7 @@
    Creates an endpoint for communication in the domain specified by domain, of type specified by type */
 PHP_FUNCTION(socket_create)
 {
-	int			arg1, arg2, arg3;
+	long			arg1, arg2, arg3;
 	php_socket	*php_sock = (php_socket*)emalloc(sizeof(php_socket));
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lll", &arg1, &arg2, &arg3) == FAILURE) {
@@ -962,7 +965,8 @@
 	struct sockaddr_in	sin;
 	struct sockaddr_un	s_un;
 	char				*addr;
-	int					retval, addr_len, port;
+	int					retval, addr_len;
+	long					port;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE)
 		return;
@@ -1012,7 +1016,7 @@
    Returns a string describing an error */
 PHP_FUNCTION(socket_strerror)
 {
-	int	arg1;
+	long	arg1;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &arg1) == FAILURE)
 		return;
@@ -1030,7 +1034,8 @@
 	struct sockaddr			*sock_type = (struct sockaddr*) &sa_storage;
 	php_socket				*php_sock;
 	char					*addr;
-	int						addr_len, port = 0;
+	int						addr_len;
+	int						port = 0;
 	long					retval = 0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &arg1, &addr, &addr_len, &port) == FAILURE)
@@ -1127,7 +1132,7 @@
 {
 	zval			*iovec_id;
 	php_iovec_t		*vector;
-	unsigned int	iovec_position;
+	unsigned long	iovec_position;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &iovec_id, &iovec_position) == FAILURE)
 		return;
@@ -1150,7 +1155,7 @@
 	zval			*iovec_id;
 	php_iovec_t		*vector;
 	int				new_val_len;
-	unsigned int	iovec_position;
+	unsigned long	iovec_position;
 	char			*new_val;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rls", &iovec_id, &iovec_position, &new_val, &new_val_len) == FAILURE)
@@ -1181,7 +1186,7 @@
 	zval			*iovec_id;
 	php_iovec_t		*vector;
 	struct iovec	*vector_array;
-	int				iov_len;
+	long				iov_len;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &iovec_id, &iov_len) == FAILURE)
 		return;
@@ -1209,7 +1214,8 @@
 	zval			*iovec_id;
 	php_iovec_t		*vector;
 	struct iovec	*vector_array;
-	unsigned int	i, iov_pos;
+	unsigned int	i;
+	unsigned long	iov_pos;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &iovec_id, &iov_pos) == FAILURE)
 		return;
@@ -1309,7 +1315,8 @@
 	zval		*php_sock_res, *buf;
 	char		*recv_buf;
 	php_socket	*php_sock;
-	int			retval, len, flags;
+	int			retval;
+	long			len, flags;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzll", &php_sock_res, &buf, &len, &flags) == FAILURE)
 		return;
@@ -1350,7 +1357,8 @@
 {
 	zval		*arg1;
 	php_socket	*php_sock;
-	int			buf_len, len, flags, retval;
+	int			buf_len, retval;
+	long			len, flags;
 	char		*buf;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rsll", &arg1, &buf, &buf_len, &len, &flags) == FAILURE)
@@ -1378,7 +1386,8 @@
 	struct sockaddr_un	s_un;
 	struct sockaddr_in	sin;
 	socklen_t			slen;
-	int					retval, arg3, arg4;
+	int					retval;
+	long					arg3, arg4;
 	char				*recv_buf, *address;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rzllz|z", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6) == FAILURE)
@@ -1454,7 +1463,8 @@
 	php_socket			*php_sock;
 	struct sockaddr_un	s_un;
 	struct sockaddr_in	sin;
-	int					retval, buf_len, len, flags, addr_len, port = 0;
+	int					retval, buf_len, addr_len;
+	long					len, flags, port = 0;
 	char				*buf, *addr;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rslls|l", &arg1, &buf, &buf_len, &len, &flags, &addr, &addr_len, &port) == FAILURE)
@@ -1662,7 +1672,8 @@
 	struct sockaddr	sa;
 	char			*addr;
 	socklen_t		salen;
-	int				flags, addr_len, port;
+	int				addr_len;
+	long				flags, port;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rrls|l", &arg1, &arg2, &flags, &addr, &addr_len, &port) == FAILURE)
 		return;
@@ -1747,7 +1758,8 @@
 	struct timeval		tv;
 	socklen_t		optlen;
 	php_socket		*php_sock;
-	int				other_val, level, optname;
+	int				other_val;
+	long				level, optname;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rll", &arg1, &level, &optname) == FAILURE)
 		return;
@@ -1810,7 +1822,8 @@
 	struct linger	lv;
 	struct timeval tv;
 	php_socket		*php_sock;
-	int				ov, optlen, retval, level, optname;
+	int				ov, optlen, retval;
+	long				level, optname;
 	void 			*opt_ptr;
 	
 	HashTable 		*opt_ht;
@@ -1902,7 +1915,7 @@
 	zval		*retval[2], *fds_array_zval;
 	php_socket	*php_sock[2];
 	SOCKET		fds_array[2];
-	int			domain, type, protocol;
+	long			domain, type, protocol;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "lllz", &domain, &type, &protocol, &fds_array_zval) == FAILURE)
 		return;
@@ -1959,7 +1972,7 @@
 PHP_FUNCTION(socket_shutdown)
 {
 	zval		*arg1;
-	int			how_shutdown = 2;
+	long			how_shutdown = 2;
 	php_socket	*php_sock;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &arg1, &how_shutdown) == FAILURE)
--- php4-STABLE-200302241430/./ext/standard/exec.c	2003-02-19 20:17:22.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/standard/exec.c	2003-03-01 14:24:24.000000000 -0500
@@ -671,7 +671,7 @@
 #define MAX_DESCRIPTORS	16
 
 	char *command;
-	long command_len;
+	int command_len;
 	zval *descriptorspec;
 	zval *pipes;
 	int ndesc = 0;
--- php4-STABLE-200302241430/./ext/standard/file.c	2003-02-23 23:13:07.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/standard/file.c	2003-03-01 14:24:24.000000000 -0500
@@ -767,7 +767,8 @@
 	struct timeval *tv_p = NULL;
 	fd_set			rfds, wfds, efds;
 	int				max_fd = 0;
-	int				retval, sets = 0, usec = 0;
+	int				retval, sets = 0;
+	long				usec = 0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a!a!a!z!|l", &r_array, &w_array, &e_array, &sec, &usec) == FAILURE)
 		return;
--- php4-STABLE-200302241430/./ext/standard/fsock.c	2003-01-08 23:09:07.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/standard/fsock.c	2003-03-01 14:24:24.000000000 -0500
@@ -136,7 +136,7 @@
 {
 	char *host;
 	int host_len;
-	int port = -1;
+	long port = -1;
 	zval *zerrno = NULL, *zerrstr = NULL;
 	double timeout = FG(default_socket_timeout);
 	unsigned long conv;
--- php4-STABLE-200302241430/./ext/standard/head.c	2002-12-31 12:15:21.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/standard/head.c	2003-03-01 14:24:24.000000000 -0500
@@ -142,7 +142,7 @@
 PHP_FUNCTION(setcookie)
 {
 	char *name, *value = NULL, *path = NULL, *domain = NULL;
-	time_t expires = 0;
+	long expires = 0;
 	zend_bool secure = 0;
 	int name_len, value_len, path_len, domain_len;
 
--- php4-STABLE-200302241430/./ext/standard/html.c	2003-01-02 15:10:39.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/standard/html.c	2003-03-01 14:24:24.000000000 -0500
@@ -830,7 +830,8 @@
 {
 	char *str, *hint_charset = NULL;
 	int str_len, hint_charset_len = 0;
-	int len, quote_style = ENT_COMPAT;
+	int len;
+	long quote_style = ENT_COMPAT;
 	char *replaced;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len,
@@ -871,7 +872,8 @@
 PHP_FUNCTION(html_entity_decode)
 {
 	char *str, *hint_charset = NULL;
-	int str_len, hint_charset_len, len, quote_style = ENT_COMPAT;
+	int str_len, hint_charset_len, len;
+	long quote_style = ENT_COMPAT;
 	char *replaced;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|ls", &str, &str_len,
@@ -897,7 +899,7 @@
    Returns the internal translation table used by htmlspecialchars and htmlentities */
 PHP_FUNCTION(get_html_translation_table)
 {
-	int which = HTML_SPECIALCHARS, quote_style = ENT_COMPAT;
+	long which = HTML_SPECIALCHARS, quote_style = ENT_COMPAT;
 	int i, j;
 	char ind[2];
 	enum entity_charset charset = determine_charset(NULL TSRMLS_CC);
--- php4-STABLE-200302241430/./ext/standard/metaphone.c	2002-12-31 12:15:21.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/standard/metaphone.c	2003-03-01 14:24:24.000000000 -0500
@@ -35,7 +35,8 @@
 {
 	char *str;
 	char *result = 0;
-	int phones = 0, str_len;
+	int str_len;
+	long phones = 0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &str, &str_len,
 							  &phones) == FAILURE) {
--- php4-STABLE-200302241430/./ext/standard/string.c	2003-02-18 14:18:08.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/standard/string.c	2003-03-01 14:28:16.000000000 -0500
@@ -202,7 +202,8 @@
 static void php_spn_common_handler(INTERNAL_FUNCTION_PARAMETERS, int behavior)
 {
 	char *s11, *s22;
-	int len1, len2, start, len;
+	int len1, len2;
+	long start, len;
 	
 	start = 0;
 	len = 0;
@@ -1219,7 +1220,7 @@
 	zval *tmp;
 	char *path, *ret = NULL;
 	int path_len;
-	int opt = PHP_PATHINFO_ALL;
+	long opt = PHP_PATHINFO_ALL;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &path, &path_len, &opt) == FAILURE) {
 		return;
--- php4-STABLE-200302241430/./ext/sysvsem/sysvsem.c	2002-12-31 12:15:22.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/sysvsem/sysvsem.c	2003-03-01 14:24:24.000000000 -0500
@@ -161,7 +161,7 @@
    Return an id for the semaphore with the given key, and allow max_acquire (default 1) processes to acquire it simultaneously */
 PHP_FUNCTION(sem_get)
 {
-	int key, max_acquire, perm, auto_release = 1;
+	long key, max_acquire, perm, auto_release = 1;
     int semid;
 	struct sembuf sop[3];
 	int count;
--- php4-STABLE-200302241430/./ext/zlib/zlib.c	2003-02-10 22:09:45.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/zlib/zlib.c	2003-03-01 14:24:24.000000000 -0500
@@ -811,7 +811,7 @@
 {
 	char *data, *s2;
 	int data_len;
-	int level = Z_DEFAULT_COMPRESSION, coding = CODING_GZIP;
+	long level = Z_DEFAULT_COMPRESSION, coding = CODING_GZIP;
 	int status;
 	z_stream stream;
 
--- php4-STABLE-200302241430/./ext/bz2/bz2.c	2002-12-31 12:15:19.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/bz2/bz2.c	2003-03-01 14:24:24.000000000 -0500
@@ -253,7 +253,7 @@
 PHP_FUNCTION(bzread)
 {
 	zval *bz;
-	int len = 1024;
+	long len = 1024;
 	php_stream *stream;
 
 	if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &bz, &len)) {
--- php4-STABLE-200302241430/./ext/openssl/openssl.c	2003-01-31 18:19:14.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/openssl/openssl.c	2003-03-01 14:24:24.000000000 -0500
@@ -712,7 +712,7 @@
 	BIO * bio_out;
 	long certresource;
 	char * filename;
-	long filename_len;
+	int filename_len;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|b", &zcert, &filename, &filename_len, &notext) == FAILURE)
 		return;
@@ -1000,7 +1000,7 @@
 	STACK_OF(X509) * untrustedchain = NULL;
 	long purpose;
 	char * untrusted = NULL;
-	long untrusted_len;
+	int untrusted_len;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl|a!s", &zcert, &purpose, &zcainfo, &untrusted, &untrusted_len)
 			== FAILURE)
@@ -1339,7 +1339,7 @@
 	X509_REQ * csr;
 	zval * zcsr = NULL;
 	zend_bool notext = 1;
-	char * filename = NULL; long filename_len;
+	char * filename = NULL; int filename_len;
 	BIO * bio_out;
 	long csr_resource;
 
@@ -1878,8 +1878,8 @@
 {
 	struct php_x509_request req;
 	zval * zpkey, * args = NULL;
-	char * passphrase = NULL; long passphrase_len = 0;
-	char * filename = NULL; long filename_len = 0;
+	char * passphrase = NULL; int passphrase_len = 0;
+	char * filename = NULL; int filename_len = 0;
 	long key_resource = -1;
 	EVP_PKEY * key;
 	BIO * bio_out = NULL;
@@ -1934,7 +1934,7 @@
 {
 	struct php_x509_request req;
 	zval * zpkey, * args = NULL, *out;
-	char * passphrase = NULL; long passphrase_len = 0;
+	char * passphrase = NULL; int passphrase_len = 0;
 	long key_resource = -1;
 	EVP_PKEY * key;
 	BIO * bio_out = NULL;
@@ -2026,7 +2026,7 @@
 	zval *cert;
 	EVP_PKEY *pkey;
 	char * passphrase = "";
-	long passphrase_len;
+	int passphrase_len;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|s", &cert, &passphrase, &passphrase_len) == FAILURE)
 		return;
@@ -2056,9 +2056,9 @@
 	PKCS7 * p7 = NULL;
 	BIO * in = NULL, * datain = NULL;
 	long flags = 0;
-	char * filename; long filename_len;
-	char * extracerts = NULL; long extracerts_len;
-	char * signersfilename = NULL; long signersfilename_len;
+	char * filename; int filename_len;
+	char * extracerts = NULL; int extracerts_len;
+	char * signersfilename = NULL; int signersfilename_len;
 	
 	RETVAL_LONG(-1);
 
@@ -2155,8 +2155,8 @@
 	uint strindexlen;
 	ulong intindex;
 	char * strindex;
-	char * infilename = NULL;	long infilename_len;
-	char * outfilename = NULL;	long outfilename_len;
+	char * infilename = NULL;	int infilename_len;
+	char * outfilename = NULL;	int outfilename_len;
 	
 	RETVAL_FALSE;
 
@@ -2281,9 +2281,9 @@
 	uint strindexlen;
 	HashPosition hpos;
 	char * strindex;
-	char * infilename;	long infilename_len;
-	char * outfilename;	long outfilename_len;
-	char * extracertsfilename = NULL; long extracertsfilename_len;
+	char * infilename;	int infilename_len;
+	char * outfilename;	int outfilename_len;
+	char * extracertsfilename = NULL; int extracertsfilename_len;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sszza!|ls",
 				&infilename, &infilename_len, &outfilename, &outfilename_len,
@@ -2381,8 +2381,8 @@
 	long certresval, keyresval;
 	BIO * in = NULL, * out = NULL, * datain = NULL;
 	PKCS7 * p7 = NULL;
-	char * infilename;	long infilename_len;
-	char * outfilename;	long outfilename_len;
+	char * infilename;	int infilename_len;
+	char * outfilename;	int outfilename_len;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz|z", &infilename, &infilename_len,
 				&outfilename, &outfilename_len, &recipcert, &recipkey) == FAILURE)
@@ -2448,7 +2448,8 @@
 	int successful = 0;
 	long keyresource = -1;
 	char * data;
-	long data_len, padding = RSA_PKCS1_PADDING;
+	int data_len;
+	long padding = RSA_PKCS1_PADDING;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE)
 		return;
@@ -2505,7 +2506,7 @@
 	long padding = RSA_PKCS1_PADDING;
 	long keyresource = -1;
 	char * data;
-	long data_len;
+	int data_len;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE)
 		return;
@@ -2568,7 +2569,7 @@
 	long keyresource = -1;
 	long padding = RSA_PKCS1_PADDING;
 	char * data;
-	long data_len;
+	int data_len;
 	
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE)
 		return;
@@ -2625,7 +2626,7 @@
 	long keyresource = -1;
 	long padding = RSA_PKCS1_PADDING;
 	char * data;
-	long data_len;
+	int data_len;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz|l", &data, &data_len, &crypted, &key, &padding) == FAILURE)
 		return;
@@ -2710,7 +2711,7 @@
 	int siglen;
 	unsigned char *sigbuf;
 	long keyresource = -1;
-	char * data;	long data_len;
+	char * data;	int data_len;
 	EVP_MD_CTX md_ctx;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szz", &data, &data_len, &signature, &key) == FAILURE)
@@ -2750,8 +2751,8 @@
 	int err;
 	EVP_MD_CTX     md_ctx;
 	long keyresource = -1;
-	char * data;	long data_len;
-	char * signature;	long signature_len;
+	char * data;	int data_len;
+	char * signature;	int signature_len;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ssz", &data, &data_len,
 				&signature, &signature_len, &key) == FAILURE)
@@ -2785,7 +2786,7 @@
 	long * key_resources;	/* so we know what to cleanup */
 	int i, len1, len2, *eksl, nkeys;
 	unsigned char *buf = NULL, **eks;
-	char * data;	long data_len;
+	char * data; int data_len;
 	EVP_CIPHER_CTX ctx;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szza/",
@@ -2913,8 +2914,8 @@
 	unsigned char *buf;
 	long keyresource = -1;
 	EVP_CIPHER_CTX ctx;
-	char * data;	long data_len;
-	char * ekey;	long ekey_len;
+	char * data;	int data_len;
+	char * ekey;	int ekey_len;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "szsz", &data, &data_len,
 				&opendata, &ekey, &ekey_len, &privkey) == FAILURE)
--- php4-STABLE-200302241430/./ext/iconv/iconv.c	2003-01-03 01:11:02.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/iconv/iconv.c	2003-03-01 14:24:44.000000000 -0500
@@ -428,7 +428,8 @@
 	char *out_buffer, *content_type, *mimetype = NULL, *s;
 	zval *zv_string;
 	unsigned int out_len;
-	int status, mimetype_alloced  = 0;
+	int mimetype_alloced  = 0;
+	long status;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zl", &zv_string, &status) == FAILURE)
 		return;
--- php4-STABLE-200302241430/./ext/mbstring/mbstring.c	2003-02-20 13:13:34.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/mbstring/mbstring.c	2003-03-01 14:24:45.000000000 -0500
@@ -1838,7 +1838,7 @@
 PHP_FUNCTION(mb_output_handler)
 {
 	char *arg_string;
-	size_t arg_string_len;
+	int arg_string_len;
 	long arg_status;
 	mbfl_string string, result;
 	const char *charset;
@@ -2626,7 +2626,7 @@
 PHP_FUNCTION(mb_convert_case)
 {
 	char *str, *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
-	long str_len, from_encoding_len;
+	int str_len, from_encoding_len;
 	long case_mode = 0;
 	char *newstr;
 	size_t ret_len;
@@ -2650,7 +2650,7 @@
 PHP_FUNCTION(mb_strtoupper)
 {
 	char *str, *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
-	long str_len, from_encoding_len;
+	int str_len, from_encoding_len;
 	char *newstr;
 	size_t ret_len;
 
@@ -2673,7 +2673,7 @@
 PHP_FUNCTION(mb_strtolower)
 {
 	char *str, *from_encoding = (char*)mbfl_no2preferred_mime_name(MBSTRG(current_internal_encoding));
-	long str_len, from_encoding_len;
+	int str_len, from_encoding_len;
 	char *newstr;
 	size_t ret_len;
 
--- php4-STABLE-200302241430/./ext/mbstring/php_mbregex.c	2003-01-21 18:09:47.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/mbstring/php_mbregex.c	2003-03-01 14:24:45.000000000 -0500
@@ -595,7 +595,8 @@
 	mb_regex_t re;
 	struct mbre_registers regs = {0, 0, 0, 0};
 	char *string;
-	int n, err, count, string_len, pos;
+	int n, err, string_len, pos;
+	long count;
 
 	count = -1;
 
--- php4-STABLE-200302241430/./ext/zip/zip.c	2002-12-31 12:15:23.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./ext/zip/zip.c	2003-03-01 14:24:45.000000000 -0500
@@ -285,7 +285,7 @@
 	zval             *zzip_ent;
 	php_zzip_dirent  *entry = NULL;
 	char             *buf   = NULL;
-	int               len   = 1024;
+	long              len   = 1024;
 	int               ret   = 0;
 
 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &zzip_ent, &len) == FAILURE) {
--- php4-STABLE-200302241430/./main/output.c	2003-02-09 15:11:54.000000000 -0500
+++ php4-STABLE-200302241430.mod2/./main/output.c	2003-03-01 14:24:45.000000000 -0500
@@ -715,7 +715,7 @@
 PHP_FUNCTION(ob_start)
 {
 	zval *output_handler=NULL;
-	uint chunk_size=0;
+	long chunk_size=0;
 	zend_bool erase=1;
 	int argc = ZEND_NUM_ARGS();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.