summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2020-03-23 23:03:51 +0000
committerandroid-build-team Robot <android-build-team-robot@google.com>2020-03-23 23:03:51 +0000
commit3b1cc09ab51622fd9b7c0d9f873f48bd7a76420c (patch)
tree42728d14fd57c4c8f686188c1cda63ece586eb96
parent66524524821c336e38c57a95ba9b360bdcc8f5d2 (diff)
parent2d3c39c7ecfe6a34b013102496979a6f02649d4a (diff)
downloadframeworks_av-3b1cc09ab51622fd9b7c0d9f873f48bd7a76420c.tar.gz
frameworks_av-3b1cc09ab51622fd9b7c0d9f873f48bd7a76420c.tar.bz2
frameworks_av-3b1cc09ab51622fd9b7c0d9f873f48bd7a76420c.zip
Snap for 6324712 from 2d3c39c7ecfe6a34b013102496979a6f02649d4a to qt-qpr3-release
Change-Id: I3090741cb51738b715d26ba3eaebd5a898fe09d8
-rw-r--r--media/mtp/MtpServer.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/media/mtp/MtpServer.cpp b/media/mtp/MtpServer.cpp
index ca8cb785e9..dd69496160 100644
--- a/media/mtp/MtpServer.cpp
+++ b/media/mtp/MtpServer.cpp
@@ -44,6 +44,7 @@
#include "MtpStringBuffer.h"
namespace android {
+static const int SN_EVENT_LOG_ID = 0x534e4554;
static const MtpOperationCode kSupportedOperationCodes[] = {
MTP_OPERATION_GET_DEVICE_INFO,
@@ -961,6 +962,17 @@ MtpResponseCode MtpServer::doSendObjectInfo() {
if (!parseDateTime(modified, modifiedTime))
modifiedTime = 0;
+ if ((strcmp(name, ".") == 0) || (strcmp(name, "..") == 0) ||
+ (strchr(name, '/') != NULL)) {
+ char errMsg[80];
+
+ snprintf(errMsg, sizeof(errMsg), "Invalid name: %s", (const char *) name);
+ ALOGE("%s (b/130656917)", errMsg);
+ android_errorWriteWithInfoLog(SN_EVENT_LOG_ID, "130656917", -1, errMsg,
+ strlen(errMsg));
+
+ return MTP_RESPONSE_INVALID_PARAMETER;
+ }
if (path[path.size() - 1] != '/')
path.append("/");
path.append(name);