Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
850263fa
Commit
850263fa
authored
Nov 25, 2015
by
Eliot Courtney
Committed by
Han-Wen Nienhuys
Dec 07, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash on listxattr syscall with NULL list argument.
parent
1f4e9748
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
4 deletions
+24
-4
fuse/pathfs/syscall_linux.go
fuse/pathfs/syscall_linux.go
+4
-0
fuse/pathfs/xattr_test.go
fuse/pathfs/xattr_test.go
+20
-4
No files found.
fuse/pathfs/syscall_linux.go
View file @
850263fa
...
...
@@ -34,6 +34,10 @@ func listXAttr(path string) (attributes []string, err error) {
sz
,
err
=
sysListxattr
(
path
,
dest
)
}
if
sz
==
0
{
return
nil
,
err
}
// -1 to drop the final empty slice.
dest
=
dest
[
:
sz
-
1
]
attributesBytes
:=
bytes
.
Split
(
dest
,
[]
byte
{
0
})
...
...
fuse/pathfs/xattr_test.go
View file @
850263fa
...
...
@@ -103,8 +103,8 @@ func readXAttr(p, a string) (val []byte, err error) {
return
getXAttr
(
p
,
a
,
val
)
}
func
xattrTestCase
(
t
*
testing
.
T
,
nm
string
)
(
mountPoint
string
,
cleanup
func
())
{
xfs
:=
NewXAttrFs
(
nm
,
xattrGolden
)
func
xattrTestCase
(
t
*
testing
.
T
,
nm
string
,
m
map
[
string
][]
byte
)
(
mountPoint
string
,
cleanup
func
())
{
xfs
:=
NewXAttrFs
(
nm
,
m
)
xfs
.
tester
=
t
mountPoint
,
err
:=
ioutil
.
TempDir
(
""
,
"go-fuse-xattr_test"
)
if
err
!=
nil
{
...
...
@@ -125,9 +125,25 @@ func xattrTestCase(t *testing.T, nm string) (mountPoint string, cleanup func())
}
}
func
TestXAttrNoAttrs
(
t
*
testing
.
T
)
{
nm
:=
xattrFilename
mountPoint
,
clean
:=
xattrTestCase
(
t
,
nm
,
make
(
map
[
string
][]
byte
))
defer
clean
()
mounted
:=
filepath
.
Join
(
mountPoint
,
nm
)
attrs
,
err
:=
listXAttr
(
mounted
)
if
err
!=
nil
{
t
.
Error
(
"Unexpected ListXAttr error"
,
err
)
}
if
len
(
attrs
)
>
0
{
t
.
Errorf
(
"ListXAttr(%s) = %s, want empty slice"
,
mounted
,
attrs
)
}
}
func
TestXAttrNoExist
(
t
*
testing
.
T
)
{
nm
:=
xattrFilename
mountPoint
,
clean
:=
xattrTestCase
(
t
,
nm
)
mountPoint
,
clean
:=
xattrTestCase
(
t
,
nm
,
xattrGolden
)
defer
clean
()
mounted
:=
filepath
.
Join
(
mountPoint
,
nm
)
...
...
@@ -144,7 +160,7 @@ func TestXAttrNoExist(t *testing.T) {
func
TestXAttrRead
(
t
*
testing
.
T
)
{
nm
:=
xattrFilename
mountPoint
,
clean
:=
xattrTestCase
(
t
,
nm
)
mountPoint
,
clean
:=
xattrTestCase
(
t
,
nm
,
xattrGolden
)
defer
clean
()
mounted
:=
filepath
.
Join
(
mountPoint
,
nm
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment