Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2ffea072 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MTP: Sanitize filename provided from MTP host#3"

parents 8f445de3 0931b108
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -969,7 +969,7 @@ MtpResponseCode MtpServer::doSendObjectInfo() {
        modifiedTime = 0;

    if ((strcmp(name, ".") == 0) || (strcmp(name, "..") == 0) ||
        (strcmp(name, "/") == 0) || (strcmp(basename(name), name) != 0)) {
        (strchr(name, '/') != NULL)) {
        char errMsg[80];

        snprintf(errMsg, sizeof(errMsg), "Invalid name: %s", (const char *) name);
@@ -981,7 +981,7 @@ MtpResponseCode MtpServer::doSendObjectInfo() {
    }
    if (path[path.size() - 1] != '/')
        path.append("/");
    path.append(basename(name));
    path.append(name);

    // check space first
    if (mSendObjectFileSize > storage->getFreeSpace())