mirror of
https://github.com/schollz/croc.git
synced 2025-10-11 05:11:06 +02:00
fix: check whether path separator + ..
This commit is contained in:
parent
519ce8c669
commit
8c4594ad31
1 changed files with 10 additions and 1 deletions
|
@ -1220,7 +1220,16 @@ func (c *Client) processMessageFileInfo(m message.Message) (done bool, err error
|
|||
for i, fi := range c.FilesToTransfer {
|
||||
// Issues #593 - sanitize the sender paths and prevent ".." from being used
|
||||
c.FilesToTransfer[i].FolderRemote = filepath.Clean(fi.FolderRemote)
|
||||
if strings.Contains(c.FilesToTransfer[i].FolderRemote, "..") {
|
||||
if strings.Contains(c.FilesToTransfer[i].FolderRemote, "../") {
|
||||
return true, fmt.Errorf("invalid path detected: '%s'", fi.FolderRemote)
|
||||
}
|
||||
if strings.Contains(c.FilesToTransfer[i].FolderRemote, "/..") {
|
||||
return true, fmt.Errorf("invalid path detected: '%s'", fi.FolderRemote)
|
||||
}
|
||||
if strings.Contains(c.FilesToTransfer[i].FolderRemote, "\\..") {
|
||||
return true, fmt.Errorf("invalid path detected: '%s'", fi.FolderRemote)
|
||||
}
|
||||
if strings.Contains(c.FilesToTransfer[i].FolderRemote, "..\\") {
|
||||
return true, fmt.Errorf("invalid path detected: '%s'", fi.FolderRemote)
|
||||
}
|
||||
// Issues #593 - disallow specific folders like .ssh
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue