|
|
|
@ -5,6 +5,7 @@ import ( |
|
|
|
"net/http" |
|
|
|
"os" |
|
|
|
"path/filepath" |
|
|
|
"strings" |
|
|
|
"xtcfs/config" |
|
|
|
"xtcfs/util" |
|
|
|
) |
|
|
|
@ -32,9 +33,10 @@ func SerInfo(w http.ResponseWriter, r *http.Request) { |
|
|
|
// 监听的目录通过?p=的方式传入
|
|
|
|
urlpath := r.URL.Query().Get("p") |
|
|
|
// 防止逃逸,造成漏洞
|
|
|
|
if urlpath == ".." { |
|
|
|
if strings.Contains(urlpath, "../") { |
|
|
|
urlpath = "." |
|
|
|
} |
|
|
|
|
|
|
|
// 监听的根目录
|
|
|
|
realFilePath := filepath.Join(config.G.FilePath, urlpath) |
|
|
|
// 时间目录的情况
|
|
|
|
|