summaryrefslogtreecommitdiffstats
path: root/media/mtp/MtpDevice.cpp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-03-14 10:33:22 -0400
committerMike Lockwood <lockwood@android.com>2011-03-14 10:33:22 -0400
commit3d74457b66533b170606347e60628e55a2af255e (patch)
tree959f5d6628976454dad2f3c5580b56ee4544cd84 /media/mtp/MtpDevice.cpp
parent33bde8d8c4fc71fb3cdd8356fd0df70ffb44fcd7 (diff)
downloadframeworks_av-3d74457b66533b170606347e60628e55a2af255e.zip
frameworks_av-3d74457b66533b170606347e60628e55a2af255e.tar.gz
frameworks_av-3d74457b66533b170606347e60628e55a2af255e.tar.bz2
MtpDevice: Handle zero length packets in readResponse()
Bug: 3509060 Change-Id: I291eefeaa667688c9e6e75da74ec3025b84065e9 Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'media/mtp/MtpDevice.cpp')
-rw-r--r--media/mtp/MtpDevice.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/media/mtp/MtpDevice.cpp b/media/mtp/MtpDevice.cpp
index 4ea8849..2e86159 100644
--- a/media/mtp/MtpDevice.cpp
+++ b/media/mtp/MtpDevice.cpp
@@ -819,6 +819,10 @@ MtpResponseCode MtpDevice::readResponse() {
return mResponse.getResponseCode();
}
int ret = mResponse.read(mRequestIn1);
+ // handle zero length packets, which might occur if the data transfer
+ // ends on a packet boundary
+ if (ret == 0)
+ ret = mResponse.read(mRequestIn1);
if (ret >= MTP_CONTAINER_HEADER_SIZE) {
mResponse.dump();
return mResponse.getResponseCode();