forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Primarily related to the path handling datatypes, to avoid unnecessary casts, where possible. Also some rework to avoid code dup. Probably more places are to go, even not path related, primarily to have less casts and unsigned integers where possible. That way, we've not only less warnings and casts, but are also safer with regard to the integer overflows. OFC it's not a panacea, but still significantly reduces the vulnerability potential.
- Loading branch information
Showing
13 changed files
with
54 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,3 @@ | ||
#ifndef READDIR_H | ||
#define READDIR_H | ||
|
||
|
||
/* | ||
* Structures and types used to implement opendir/readdir/closedir | ||
* on Windows 95/NT. | ||
*/ | ||
|
||
#include <windows.h> | ||
|
||
#include <io.h> | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <sys/types.h> | ||
#include <direct.h> | ||
|
||
/* struct dirent - same as Unix */ | ||
|
||
struct dirent { | ||
long d_ino; /* inode (always 1 in WIN32) */ | ||
off_t d_off; /* offset to this dirent */ | ||
unsigned short d_reclen; /* length of d_name */ | ||
char d_name[_MAX_FNAME + 1]; /* filename (null terminated) */ | ||
}; | ||
|
||
|
||
/* typedef DIR - not the same as Unix */ | ||
typedef struct { | ||
HANDLE handle; /* _findfirst/_findnext handle */ | ||
short offset; /* offset into directory */ | ||
short finished; /* 1 if there are not more files */ | ||
WIN32_FIND_DATA fileinfo; /* from _findfirst/_findnext */ | ||
char *dir; /* the dir we are reading */ | ||
struct dirent dent; /* the dirent to return */ | ||
} DIR; | ||
|
||
/* Function prototypes */ | ||
DIR *opendir(const char *); | ||
struct dirent *readdir(DIR *); | ||
int readdir_r(DIR *, struct dirent *, struct dirent **); | ||
int closedir(DIR *); | ||
int rewinddir(DIR *); | ||
|
||
#endif /* READDIR_H */ | ||
/* Keep this header for compatibility with external code, it's currently not | ||
used anywhere in the core and there are no implementations in TSRM. */ | ||
#include "win32/readdir.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters