Permalink
Browse files

mtp: be more lenient with incorrect size declarations in decodeRep.

This has been observed in the wild with AndroidGetPartialObject64
calls, on Nexus 5, Android 5.1.1.

Fixes #101.
  • Loading branch information...
1 parent 68d7387 commit bc7c0f716e3b4ed5610069a55fc00828ebba890b @hanwen committed Sep 17, 2015
Showing with 1 addition and 1 deletion.
  1. +1 −1 mtp/mtp.go
View
2 mtp/mtp.go
@@ -247,7 +247,7 @@ func (d *Device) decodeRep(h *usbBulkHeader, rest []byte, rep *Container) error
rep.TransactionID = h.TransactionID
restLen := int(h.Length) - usbHdrLen
- if restLen != len(rest) {
+ if restLen > len(rest) {
return fmt.Errorf("header specified 0x%x bytes, but have 0x%x",
restLen, len(rest))
}

0 comments on commit bc7c0f7

Please sign in to comment.