File tree 2 files changed +10
-1
lines changed
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ func isCrossBoundaries(path string) bool {
37
37
path = filepath .ToSlash (path )
38
38
path = filepath .Clean (path )
39
39
40
- return strings .HasPrefix (path , ".." )
40
+ return strings .HasPrefix (path , ".." + string ( filepath . Separator ) )
41
41
}
42
42
43
43
func (fs * ChrootHelper ) Create (filename string ) (billy.File , error ) {
Original file line number Diff line number Diff line change @@ -37,6 +37,15 @@ func (s *ChrootSuite) TestCreateErrCrossedBoundary(c *C) {
37
37
c .Assert (err , Equals , billy .ErrCrossedBoundary )
38
38
}
39
39
40
+ func (s * ChrootSuite ) TestLeadingPeriodsPathNotCrossedBoundary (c * C ) {
41
+ m := & test.BasicMock {}
42
+
43
+ fs := New (m , "/foo" )
44
+ f , err := fs .Create ("..foo" )
45
+ c .Assert (err , IsNil )
46
+ c .Assert (f .Name (), Equals , "..foo" )
47
+ }
48
+
40
49
func (s * ChrootSuite ) TestOpen (c * C ) {
41
50
m := & test.BasicMock {}
42
51
You can’t perform that action at this time.
0 commit comments