diff options
author | Anatol Belski <ab@php.net> | 2017-07-26 23:10:07 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2017-07-27 20:11:21 +0200 |
commit | 49d9b3013fb2ee18b59694aa36036104a4bdd6f2 (patch) | |
tree | 40da76daa5117b1ba623c3e6fcc5c4d44ce94777 /ext/zip/php_zip.c | |
parent | 00bed31d9f24ce46b461e911c06d7a8b6e2cf1c0 (diff) | |
download | php-git-49d9b3013fb2ee18b59694aa36036104a4bdd6f2.tar.gz |
Move cwd_state and path related routines to size_t
Having `int` there is no real profit in the size or speed, while unsigned
improves security and overall integration. ZPP supplied strings can
be then accepted directly and structs can be still handled with smaller
unsigned types for size reasons, which is safe. Yet some related places
are to go.
basic move tsrm_realpath_r to size_t
fix conditions and sync with affected places
touch ocurrences of php_sys_readlink usage
follow up on phar path handling
remove duplicated check
move zend_resolve_path and related pieces to size_t
touch yet resolve path related places
remove cast
missing pieces
missing piece
yet cleanups for php_sys_readlink for ssize_t
fix wrong return
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 2353519be4..d50c735845 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -137,18 +137,18 @@ static char * php_zip_make_relative_path(char *path, size_t path_len) /* {{{ */ # define CWD_STATE_FREE(s) efree(s) /* {{{ php_zip_extract_file */ -static int php_zip_extract_file(struct zip * za, char *dest, char *file, int file_len) +static int php_zip_extract_file(struct zip * za, char *dest, char *file, size_t file_len) { php_stream_statbuf ssb; struct zip_file *zf; struct zip_stat sb; char b[8192]; - int n, len, ret; + int n, ret; php_stream *stream; char *fullpath; char *file_dirname_fullpath; char file_dirname[MAXPATHLEN]; - size_t dir_len; + size_t dir_len, len; int is_dir_only = 0; char *path_cleaned; size_t path_cleaned_len; @@ -181,7 +181,7 @@ static int php_zip_extract_file(struct zip * za, char *dest, char *file, int fil memcpy(file_dirname, path_cleaned, path_cleaned_len); dir_len = php_dirname(file_dirname, path_cleaned_len); - if (dir_len <= 0 || (dir_len == 1 && file_dirname[0] == '.')) { + if (!dir_len || (dir_len == 1 && file_dirname[0] == '.')) { len = spprintf(&file_dirname_fullpath, 0, "%s", dest); } else { len = spprintf(&file_dirname_fullpath, 0, "%s/%s", dest, file_dirname); |