do not allow .. in selector
git-svn-id: file:///srv/svn/repo/tokiko/trunk@7 8f5ca974-a7f8-e144-9f80-d41d5039c194
This commit is contained in:
parent
4feb13d288
commit
524bdb0dd6
4
main.go
4
main.go
@ -96,6 +96,8 @@ func connHandle(c net.Conn) {
|
||||
|
||||
if selector == "" {
|
||||
printGophermap(c, "./")
|
||||
} else if strings.Contains(selector, "..") {
|
||||
writeError(c, "Selector contains ..")
|
||||
} else if selector[0] == '/' {
|
||||
info, err := os.Stat(selector[1:])
|
||||
if err != nil {
|
||||
@ -112,7 +114,7 @@ func connHandle(c net.Conn) {
|
||||
printFile(c, selector[1:])
|
||||
}
|
||||
} else {
|
||||
writeError(c, "Selector doesn't start with a / or it contains a ..")
|
||||
writeError(c, "Selector doesn't start with a /")
|
||||
}
|
||||
|
||||
c.Close()
|
||||
|
Loading…
x
Reference in New Issue
Block a user