mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-19 14:38:18 +00:00
Use str_find
from src/base/system.h
and check for C:
on Windows
Previously, using drive-relative paths could be used to escape the Teeworlds directory on Windows.
This commit is contained in:
parent
59b33b95e4
commit
1a50d405cb
|
@ -3,7 +3,6 @@
|
|||
#include <base/system.h>
|
||||
#include <engine/storage.h>
|
||||
#include "linereader.h"
|
||||
#include <string.h>
|
||||
|
||||
// compiled-in data-dir path
|
||||
#define DATA_DIR "data"
|
||||
|
@ -281,7 +280,11 @@ public:
|
|||
BufferSize = sizeof(aBuffer);
|
||||
}
|
||||
|
||||
if(pFilename[0] == '/' || pFilename[0] == '\\' || strstr(pFilename, "../") != NULL || strstr(pFilename, "..\\") != NULL)
|
||||
if(pFilename[0] == '/' || pFilename[0] == '\\' || str_find(pFilename, "../") != NULL || str_find(pFilename, "..\\") != NULL
|
||||
#ifdef CONF_FAMILY_WINDOWS
|
||||
|| (pFilename[0] && pFilename[1] == ':')
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// don't escape base directory
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue