diff --git a/Zend/zend_virtual_cwd.c b/Zend/zend_virtual_cwd.c index 404a5cfea4c..14e55fab447 100644 --- a/Zend/zend_virtual_cwd.c +++ b/Zend/zend_virtual_cwd.c @@ -120,7 +120,7 @@ static cwd_state main_cwd_state; /* True global */ static int php_is_dir_ok(const cwd_state *state) /* {{{ */ { - zend_stat_t buf; + zend_stat_t buf = {0}; if (php_sys_stat(state->cwd, &buf) == 0 && S_ISDIR(buf.st_mode)) return (0); @@ -131,7 +131,7 @@ static int php_is_dir_ok(const cwd_state *state) /* {{{ */ static int php_is_file_ok(const cwd_state *state) /* {{{ */ { - zend_stat_t buf; + zend_stat_t buf = {0}; if (php_sys_stat(state->cwd, &buf) == 0 && S_ISREG(buf.st_mode)) return (0); diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 74dba4bf698..0da72209b09 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -4376,7 +4376,7 @@ static bool exif_discard_imageinfo(image_info_type *ImageInfo) static bool exif_read_from_impl(image_info_type *ImageInfo, php_stream *stream, int read_thumbnail, int read_all) { bool ret; - zend_stat_t st; + zend_stat_t st = {0}; /* Start with an empty image information structure. */ memset(ImageInfo, 0, sizeof(*ImageInfo)); diff --git a/ext/fileinfo/libmagic/apprentice.c b/ext/fileinfo/libmagic/apprentice.c index 8cfdb5e19d9..e1ba0685326 100644 --- a/ext/fileinfo/libmagic/apprentice.c +++ b/ext/fileinfo/libmagic/apprentice.c @@ -1187,7 +1187,7 @@ load_1(struct magic_set *ms, int action, const char *fn, int *errs, continue; } if ((*bang[i].fun)(ms, &me, - line + bang[i].len + 2, + line + bang[i].len + 2, len - bang[i].len - 2) != 0) { (*errs)++; continue; @@ -1324,7 +1324,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) uint32_t i, j; size_t files = 0, maxfiles = 0; char **filearr = NULL; - zend_stat_t st; + zend_stat_t st = {0}; struct magic_map *map; struct magic_entry_set mset[MAGIC_SETS]; php_stream *dir; @@ -1419,7 +1419,7 @@ apprentice_load(struct magic_set *ms, const char *fn, int action) /* coalesce per file arrays into a single one, if needed */ if (mset[j].count == 0) continue; - + if (coalesce_entries(ms, mset[j].me, mset[j].count, &map->magic[j], &map->nmagic[j]) == -1) { errs++; diff --git a/ext/fileinfo/libmagic/magic.c b/ext/fileinfo/libmagic/magic.c index 9b80dab1c72..4ed986b17ce 100644 --- a/ext/fileinfo/libmagic/magic.c +++ b/ext/fileinfo/libmagic/magic.c @@ -188,7 +188,7 @@ file_or_stream(struct magic_set *ms, const char *inname, php_stream *stream) { int rv = -1; unsigned char *buf; - zend_stat_t sb; + zend_stat_t sb = {0}; ssize_t nbytes = 0; /* number of bytes read from a datafile */ int no_in_stream = 0; diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c index 506074172a3..7e36486b07e 100644 --- a/ext/openssl/openssl.c +++ b/ext/openssl/openssl.c @@ -2364,7 +2364,7 @@ static X509_STORE *php_openssl_setup_verify(zval *calist) X509_LOOKUP * dir_lookup, * file_lookup; int ndirs = 0, nfiles = 0; zval * item; - zend_stat_t sb; + zend_stat_t sb = {0}; store = X509_STORE_new(); diff --git a/ext/session/mod_files.c b/ext/session/mod_files.c index 1da25ba583e..09721715553 100644 --- a/ext/session/mod_files.c +++ b/ext/session/mod_files.c @@ -283,7 +283,7 @@ static int ps_files_cleanup_dir(const char *dirname, zend_long maxlifetime) { DIR *dir; struct dirent *entry; - zend_stat_t sbuf; + zend_stat_t sbuf = {0}; char buf[MAXPATHLEN]; time_t now; int nrdels = 0; @@ -340,7 +340,7 @@ static int ps_files_cleanup_dir(const char *dirname, zend_long maxlifetime) static int ps_files_key_exists(ps_files *data, const char *key) { char buf[MAXPATHLEN]; - zend_stat_t sbuf; + zend_stat_t sbuf = {0}; if (!key || !ps_files_path_create(buf, sizeof(buf), data, key)) { return FAILURE; @@ -473,7 +473,7 @@ PS_CLOSE_FUNC(files) PS_READ_FUNC(files) { zend_long n = 0; - zend_stat_t sbuf; + zend_stat_t sbuf = {0}; PS_FILES_DATA; ps_files_open(data, ZSTR_VAL(key)); diff --git a/ext/session/session.c b/ext/session/session.c index 8212ad23cd7..5f3d3384d21 100644 --- a/ext/session/session.c +++ b/ext/session/session.c @@ -1153,7 +1153,7 @@ static inline void strcpy_gmt(char *ubuf, time_t *when) /* {{{ */ static inline void last_modified(void) /* {{{ */ { const char *path; - zend_stat_t sb; + zend_stat_t sb = {0}; char buf[MAX_STR + 1]; path = SG(request_info).path_translated; diff --git a/ext/standard/pageinfo.c b/ext/standard/pageinfo.c index 8e15d2b06c3..5406662141d 100644 --- a/ext/standard/pageinfo.c +++ b/ext/standard/pageinfo.c @@ -50,7 +50,7 @@ /* {{{ php_statpage */ PHPAPI void php_statpage(void) { - zend_stat_t *pstat; + zend_stat_t *pstat = {0}; pstat = sapi_get_stat(); diff --git a/ext/standard/php_fopen_wrapper.c b/ext/standard/php_fopen_wrapper.c index 0353c8efae6..8926485025a 100644 --- a/ext/standard/php_fopen_wrapper.c +++ b/ext/standard/php_fopen_wrapper.c @@ -392,7 +392,7 @@ php_stream * php_stream_url_wrap_php(php_stream_wrapper *wrapper, const char *pa #if defined(S_IFSOCK) && !defined(PHP_WIN32) do { - zend_stat_t st; + zend_stat_t st = {0}; memset(&st, 0, sizeof(st)); if (zend_fstat(fd, &st) == 0 && (st.st_mode & S_IFMT) == S_IFSOCK) { stream = php_stream_sock_open_from_socket(fd, NULL); diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c index e9a3dff2781..8d4abb3d26b 100644 --- a/ext/xmlwriter/php_xmlwriter.c +++ b/ext/xmlwriter/php_xmlwriter.c @@ -155,7 +155,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i dir_len = php_dirname(file_dirname, strlen(source)); if (dir_len > 0) { - zend_stat_t buf; + zend_stat_t buf = {0}; if (php_sys_stat(file_dirname, &buf) != 0) { xmlFreeURI(uri); return NULL; diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index e54c4976247..ab0ecda212f 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -685,7 +685,7 @@ int php_zip_glob(char *pattern, int pattern_len, zend_long flags, zval *return_v * able to filter directories out. */ if (flags & GLOB_ONLYDIR) { - zend_stat_t s; + zend_stat_t s = {0}; if (0 != VCWD_STAT(globbuf.gl_pathv[n], &s)) { continue; @@ -757,7 +757,7 @@ int php_zip_pcre(zend_string *regexp, char *path, int path_len, zval *return_val /* only the files, directories are ignored */ for (i = 0; i < files_cnt; i++) { - zend_stat_t s; + zend_stat_t s = {0}; char fullpath[MAXPATHLEN]; size_t namelist_len = ZSTR_LEN(namelist[i]); @@ -1482,7 +1482,7 @@ PHP_METHOD(ZipArchive, open) #else if ((flags & ZIP_TRUNCATE) == 0) { #endif - zend_stat_t st; + zend_stat_t st = {0}; /* exists and is empty */ if (VCWD_STAT(resolved_path, &st) == 0 && st.st_size == 0) { diff --git a/main/main.c b/main/main.c index 3bdd01169ee..1ed43efb8a2 100644 --- a/main/main.c +++ b/main/main.c @@ -363,7 +363,7 @@ static void php_binary_init(void) if ((envpath = getenv("PATH")) != NULL) { char *search_dir, search_path[MAXPATHLEN]; char *last = NULL; - zend_stat_t s; + zend_stat_t s = {0}; path = estrdup(envpath); search_dir = php_strtok_r(path, ":", &last); @@ -1397,7 +1397,7 @@ static ZEND_COLD void php_error_cb(int orig_type, zend_string *error_filename, c /* {{{ php_get_current_user */ PHPAPI char *php_get_current_user(void) { - zend_stat_t *pstat; + zend_stat_t *pstat = {0}; if (SG(request_info).current_user) { return SG(request_info).current_user; diff --git a/main/php_ini.c b/main/php_ini.c index 0f3fdcd502f..2ff259f6e11 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -768,7 +768,7 @@ void php_ini_register_extensions(void) /* {{{ php_parse_user_ini_file */ PHPAPI int php_parse_user_ini_file(const char *dirname, const char *ini_filename, HashTable *target_hash) { - zend_stat_t sb; + zend_stat_t sb = {0}; char ini_file[MAXPATHLEN]; snprintf(ini_file, MAXPATHLEN, "%s%c%s", dirname, DEFAULT_SLASH, ini_filename); diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c index 4f9a71bfac6..eb7ece3f1cd 100644 --- a/sapi/cgi/cgi_main.c +++ b/sapi/cgi/cgi_main.c @@ -1210,7 +1210,7 @@ static void init_request_info(fcgi_request *request) #endif if (CGIG(fix_pathinfo)) { - zend_stat_t st; + zend_stat_t st = {0}; char *real_path = NULL; char *env_redirect_url = CGI_GETENV("REDIRECT_URL"); char *env_document_root = CGI_GETENV("DOCUMENT_ROOT"); diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c index e39a5c7fb4e..440f526f2be 100644 --- a/sapi/phpdbg/phpdbg.c +++ b/sapi/phpdbg/phpdbg.c @@ -268,7 +268,7 @@ PHP_FUNCTION(phpdbg_exec) } { - zend_stat_t sb; + zend_stat_t sb = {0}; bool result = 1; if (VCWD_STAT(ZSTR_VAL(exec), &sb) != FAILURE) { diff --git a/sapi/phpdbg/phpdbg_prompt.c b/sapi/phpdbg/phpdbg_prompt.c index dfdac95cae5..0aa13475eab 100644 --- a/sapi/phpdbg/phpdbg_prompt.c +++ b/sapi/phpdbg/phpdbg_prompt.c @@ -306,7 +306,7 @@ void phpdbg_string_init(char *buffer) { void phpdbg_try_file_init(char *init_file, size_t init_file_len, bool free_init) /* {{{ */ { - zend_stat_t sb; + zend_stat_t sb = {0}; if (init_file && VCWD_STAT(init_file, &sb) != -1) { FILE *fp = fopen(init_file, "r"); @@ -398,7 +398,7 @@ void phpdbg_clean(bool full, bool resubmit) /* {{{ */ PHPDBG_COMMAND(exec) /* {{{ */ { - zend_stat_t sb; + zend_stat_t sb = {0}; if (VCWD_STAT(param->str, &sb) != FAILURE) { if (sb.st_mode & (S_IFREG|S_IFLNK)) { @@ -1390,7 +1390,7 @@ PHPDBG_COMMAND(dl) /* {{{ */ PHPDBG_COMMAND(source) /* {{{ */ { - zend_stat_t sb; + zend_stat_t sb = {0}; if (VCWD_STAT(param->str, &sb) != -1) { phpdbg_try_file_init(param->str, param->len, 0); diff --git a/win32/glob.c b/win32/glob.c index 578284cb3de..357809e3369 100644 --- a/win32/glob.c +++ b/win32/glob.c @@ -553,7 +553,7 @@ glob2(pathbuf, pathbuf_last, pathend, pathend_last, pattern, glob_t *pglob; size_t *limitp; { - zend_stat_t sb; + zend_stat_t sb = {0}; Char *p, *q; int anymeta; @@ -850,7 +850,7 @@ g_opendir(str, pglob) static int g_lstat(fn, sb, pglob) register Char *fn; - zend_stat_t *sb; + zend_stat_t *sb = {0}; glob_t *pglob; { char buf[MAXPATHLEN]; @@ -865,7 +865,7 @@ g_lstat(fn, sb, pglob) static int g_stat(fn, sb, pglob) register Char *fn; - zend_stat_t *sb; + zend_stat_t *sb = {0}; glob_t *pglob; { char buf[MAXPATHLEN];