mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 03:22:48 -05:00
General mechanism for ensuring a dodgy SFTP server can't return
malicious filenames via FXP_READDIR. [originally from svn r4995]
This commit is contained in:
@ -445,6 +445,17 @@ void finish_wildcard_matching(WildcardMatcher *dir)
|
||||
sfree(dir);
|
||||
}
|
||||
|
||||
int vet_filename(char *name)
|
||||
{
|
||||
if (strchr(name, '/') || strchr(name, '\\') || strchr(name, ':'))
|
||||
return FALSE;
|
||||
|
||||
if (!name[strspn(name, ".")]) /* entirely composed of dots */
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int create_directory(char *name)
|
||||
{
|
||||
return CreateDirectory(name, NULL) != 0;
|
||||
|
Reference in New Issue
Block a user