Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Handle boundary conditions too.

  • Loading branch information...
commit 9eb1955afe122098d9ba916bb05b6e2e415a015c 1 parent cc1f1f2
@hanwen authored
Showing with 4 additions and 1 deletion.
  1. +4 −1 fs/android.go
View
5 fs/android.go
@@ -80,11 +80,14 @@ type androidFile struct {
}
func (f *androidFile) Read(dest []byte, off int64) (fuse.ReadResult, fuse.Status) {
- if off > f.node.Size {
+ if off >= f.node.Size {
// ENXIO = no such address.
return nil, fuse.Status(int(syscall.ENXIO))
}
+ if off+int64(len(dest)) > f.node.Size {
+ dest = dest[:f.node.Size-off]
+ }
b := bytes.NewBuffer(dest[:0])
err := f.node.fs.dev.AndroidGetPartialObject64(f.node.Handle(), b, off, uint32(len(dest)))
if err != nil {
Please sign in to comment.
Something went wrong with that request. Please try again.