Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
8e0f92b6
Unverified
Commit
8e0f92b6
authored
Jan 28, 2020
by
Steven Allen
Committed by
GitHub
Jan 28, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6847 from ipfs/fix/6765
fix: fix a potential out of bounds issue in fuse
parents
e8f7f0a5
41aaf745
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
11 deletions
+6
-11
fuse/readonly/readonly_unix.go
fuse/readonly/readonly_unix.go
+6
-11
No files found.
fuse/readonly/readonly_unix.go
View file @
8e0f92b6
...
...
@@ -257,13 +257,15 @@ func (s *Node) Read(ctx context.Context, req *fuse.ReadRequest, resp *fuse.ReadR
if
err
!=
nil
{
return
err
}
buf
:=
resp
.
Data
[
:
m
in
(
req
.
Size
,
int
(
int64
(
r
.
Size
())
-
req
.
Offset
)
)]
// Data has a capacity of Size
buf
:=
resp
.
Data
[
:
in
t
(
req
.
Size
)]
n
,
err
:=
io
.
ReadFull
(
r
,
buf
)
if
err
!=
nil
&&
err
!=
io
.
EOF
{
resp
.
Data
=
buf
[
:
n
]
switch
err
{
case
nil
,
io
.
EOF
,
io
.
ErrUnexpectedEOF
:
default
:
return
err
}
resp
.
Data
=
resp
.
Data
[
:
n
]
lm
[
"res_size"
]
=
n
return
nil
// may be non-nil / not succeeded
}
...
...
@@ -287,10 +289,3 @@ type roNode interface {
}
var
_
roNode
=
(
*
Node
)(
nil
)
func
min
(
a
,
b
int
)
int
{
if
a
<
b
{
return
a
}
return
b
}
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