mirror of
https://github.com/arkadiyt/protodump.git
synced 2026-10-21 09:46:52 +02:00
Fix file traversal
This commit is contained in:
1 parent
e5815840e4
commit
cd9602ffac
1 file changed
+1
-1
@@ -44,7 +44,7 @@ func writeFile(outputDir string, filename string, content []byte) (string, error
|
||||
return "", fmt.Errorf("failed to evalsymlinks on %s: %v", eval, err)
|
||||
}
|
||||
|
||||
if !strings.HasPrefix(base, outputDirAbs) {
|
||||
if base != outputDirAbs && !strings.HasPrefix(base, outputDirAbs+string(filepath.Separator)) {
|
||||
return "", fmt.Errorf("invalid filepath: %s", base)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user