mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- fixed path traversal on POSIX platforms
This commit is contained in:
parent
93fb98413e
commit
9dd3213393
4 changed files with 7 additions and 4 deletions
|
@ -162,7 +162,7 @@ void CollectSubdirectories(TArray<FString> &searchpath, const char *dirmatch)
|
|||
{
|
||||
findstate_t findstate;
|
||||
void* handle;
|
||||
if ((handle = I_FindFirst(AbsPath + "/*.*", &findstate)) != (void*)-1)
|
||||
if ((handle = I_FindFirst(AbsPath + "/*", &findstate)) != (void*)-1)
|
||||
{
|
||||
do
|
||||
{
|
||||
|
|
|
@ -180,6 +180,7 @@ void* I_FindFirst(const char* const filespec, findstate_t* const fileinfo)
|
|||
{
|
||||
pattern = slash+1;
|
||||
dir = FString(filespec, slash - filespec + 1);
|
||||
fileinfo->path = dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -234,7 +235,7 @@ int I_FindAttr(findstate_t* const fileinfo)
|
|||
dirent* const ent = fileinfo->namelist[fileinfo->current];
|
||||
bool isdir;
|
||||
|
||||
if (DirEntryExists(ent->d_name, &isdir))
|
||||
if (DirEntryExists(fileinfo->path + ent->d_name, &isdir))
|
||||
{
|
||||
return isdir ? FA_DIREC : 0;
|
||||
}
|
||||
|
|
|
@ -73,9 +73,10 @@ bool I_SetCursor(FTexture *);
|
|||
struct findstate_t
|
||||
{
|
||||
private:
|
||||
int count;
|
||||
FString path;
|
||||
struct dirent **namelist;
|
||||
int current;
|
||||
int count;
|
||||
|
||||
friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo);
|
||||
friend int I_FindNext(void *handle, findstate_t *fileinfo);
|
||||
|
|
|
@ -304,6 +304,7 @@ void *I_FindFirst (const char *filespec, findstate_t *fileinfo)
|
|||
{
|
||||
pattern = slash+1;
|
||||
dir = FString(filespec, slash-filespec+1);
|
||||
fileinfo->path = dir;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -350,7 +351,7 @@ int I_FindAttr(findstate_t* const fileinfo)
|
|||
dirent* const ent = fileinfo->namelist[fileinfo->current];
|
||||
bool isdir;
|
||||
|
||||
if (DirEntryExists(ent->d_name, &isdir))
|
||||
if (DirEntryExists(fileinfo->path + ent->d_name, &isdir))
|
||||
{
|
||||
return isdir ? FA_DIREC : 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue