mirror of
https://github.com/akuker/RASCSI.git
synced 2024-12-22 15:30:09 +00:00
Improved filename validation
This commit is contained in:
parent
9663144c45
commit
5b3af7cf9d
@ -717,8 +717,12 @@ string SetReservedIds(const string& ids)
|
||||
|
||||
bool IsValidFilename(const string& filename)
|
||||
{
|
||||
if (filename == "." || filename == "..") {
|
||||
return false;
|
||||
}
|
||||
|
||||
struct stat st;
|
||||
return !stat(filename.c_str(), &st) && S_ISREG(st.st_mode);
|
||||
return stat(filename.c_str(), &st) || !S_ISREG(st.st_mode);
|
||||
}
|
||||
|
||||
bool CreateImage(int fd, const PbCommand& command)
|
||||
|
Loading…
Reference in New Issue
Block a user