General mechanism for ensuring a dodgy SFTP server can't return
[u/mdw/putty] / windows / winsftp.c
index c071257..82bea80 100644 (file)
@@ -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;