mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Initialise zend_stat_t to fix MSAN build
This commit is contained in:
parent
cc506a81e1
commit
2ecd46f48f
17 changed files with 29 additions and 29 deletions
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -50,7 +50,7 @@
|
|||
/* {{{ php_statpage */
|
||||
PHPAPI void php_statpage(void)
|
||||
{
|
||||
zend_stat_t *pstat;
|
||||
zend_stat_t *pstat = {0};
|
||||
|
||||
pstat = sapi_get_stat();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue