From 9b88b72ee2c3fd01fb46e77b7e6d80f3bd52e958 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Mon, 11 Jul 2011 09:18:03 -0400 Subject: MTP: Return error if user tries to copy a file >= 4GB to a FAT32 file system Bug: 4561836 Change-Id: I2bffb93b032038f6c220c24c752ccd7ca66c23a0 Signed-off-by: Mike Lockwood --- media/mtp/MtpServer.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'media/mtp/MtpServer.cpp') diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp index bc04e8c..9085f10 100644 --- a/media/mtp/MtpServer.cpp +++ b/media/mtp/MtpServer.cpp @@ -871,6 +871,14 @@ MtpResponseCode MtpServer::doSendObjectInfo() { // check space first if (mSendObjectFileSize > storage->getFreeSpace()) return MTP_RESPONSE_STORAGE_FULL; + uint64_t maxFileSize = storage->getMaxFileSize(); + // check storage max file size + if (maxFileSize != 0) { + // if mSendObjectFileSize is 0xFFFFFFFF, then all we know is the file size + // is >= 0xFFFFFFFF + if (mSendObjectFileSize > maxFileSize || mSendObjectFileSize == 0xFFFFFFFF) + return MTP_RESPONSE_OBJECT_TOO_LARGE; + } LOGD("path: %s parent: %d storageID: %08X", (const char*)path, parent, storageID); MtpObjectHandle handle = mDatabase->beginSendObject((const char*)path, -- cgit v1.1