mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 14:52:01 +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;
|
findstate_t findstate;
|
||||||
void* handle;
|
void* handle;
|
||||||
if ((handle = I_FindFirst(AbsPath + "/*.*", &findstate)) != (void*)-1)
|
if ((handle = I_FindFirst(AbsPath + "/*", &findstate)) != (void*)-1)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,6 +180,7 @@ void* I_FindFirst(const char* const filespec, findstate_t* const fileinfo)
|
||||||
{
|
{
|
||||||
pattern = slash+1;
|
pattern = slash+1;
|
||||||
dir = FString(filespec, slash - filespec + 1);
|
dir = FString(filespec, slash - filespec + 1);
|
||||||
|
fileinfo->path = dir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -234,7 +235,7 @@ int I_FindAttr(findstate_t* const fileinfo)
|
||||||
dirent* const ent = fileinfo->namelist[fileinfo->current];
|
dirent* const ent = fileinfo->namelist[fileinfo->current];
|
||||||
bool isdir;
|
bool isdir;
|
||||||
|
|
||||||
if (DirEntryExists(ent->d_name, &isdir))
|
if (DirEntryExists(fileinfo->path + ent->d_name, &isdir))
|
||||||
{
|
{
|
||||||
return isdir ? FA_DIREC : 0;
|
return isdir ? FA_DIREC : 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,9 +73,10 @@ bool I_SetCursor(FTexture *);
|
||||||
struct findstate_t
|
struct findstate_t
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int count;
|
FString path;
|
||||||
struct dirent **namelist;
|
struct dirent **namelist;
|
||||||
int current;
|
int current;
|
||||||
|
int count;
|
||||||
|
|
||||||
friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo);
|
friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo);
|
||||||
friend int I_FindNext(void *handle, 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;
|
pattern = slash+1;
|
||||||
dir = FString(filespec, slash-filespec+1);
|
dir = FString(filespec, slash-filespec+1);
|
||||||
|
fileinfo->path = dir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -350,7 +351,7 @@ int I_FindAttr(findstate_t* const fileinfo)
|
||||||
dirent* const ent = fileinfo->namelist[fileinfo->current];
|
dirent* const ent = fileinfo->namelist[fileinfo->current];
|
||||||
bool isdir;
|
bool isdir;
|
||||||
|
|
||||||
if (DirEntryExists(ent->d_name, &isdir))
|
if (DirEntryExists(fileinfo->path + ent->d_name, &isdir))
|
||||||
{
|
{
|
||||||
return isdir ? FA_DIREC : 0;
|
return isdir ? FA_DIREC : 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue