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

Commit c93cf8a7 authored by Josh Gao's avatar Josh Gao Committed by android-build-merger
Browse files

Merge "Increase the maximum shell command length to 4096ish." am: 3472410e

am: 2783126c

* commit '2783126c':
  Increase the maximum shell command length to 4096ish.
parents 2dd90a20 2783126c
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -857,8 +857,7 @@ int handle_forward_request(const char* service, TransportType type, const char*
#if ADB_HOST
#if ADB_HOST
        SendOkay(reply_fd);
        SendOkay(reply_fd);
#endif
#endif
        SendProtocolString(reply_fd, listeners);
        return SendProtocolString(reply_fd, listeners);
        return 1;
    }
    }


    if (!strcmp(service, "killforward-all")) {
    if (!strcmp(service, "killforward-all")) {
+1 −1
Original line number Original line Diff line number Diff line
@@ -124,7 +124,7 @@ bool adb_status(int fd, std::string* error) {


int _adb_connect(const std::string& service, std::string* error) {
int _adb_connect(const std::string& service, std::string* error) {
    D("_adb_connect: %s", service.c_str());
    D("_adb_connect: %s", service.c_str());
    if (service.empty() || service.size() > 1024) {
    if (service.empty() || service.size() > MAX_PAYLOAD_V1) {
        *error = android::base::StringPrintf("bad service name length (%zd)",
        *error = android::base::StringPrintf("bad service name length (%zd)",
                                             service.size());
                                             service.size());
        return -1;
        return -1;
+5 −3
Original line number Original line Diff line number Diff line
@@ -22,14 +22,16 @@


#include <android-base/stringprintf.h>
#include <android-base/stringprintf.h>


#include "adb.h"
#include "adb_trace.h"
#include "adb_trace.h"
#include "adb_utils.h"
#include "adb_utils.h"
#include "sysdeps.h"
#include "sysdeps.h"


bool SendProtocolString(int fd, const std::string& s) {
bool SendProtocolString(int fd, const std::string& s) {
    int length = s.size();
    unsigned int length = s.size();
    if (length > 0xffff) {
    if (length > MAX_PAYLOAD_V1 - 4) {
        length = 0xffff;
        errno = EMSGSIZE;
        return false;
    }
    }


    // The cost of sending two strings outweighs the cost of formatting.
    // The cost of sending two strings outweighs the cost of formatting.
+3 −3
Original line number Original line Diff line number Diff line
@@ -702,7 +702,7 @@ static int smart_socket_enqueue(asocket *s, apacket *p)
    if(p->len < 4) return 0;
    if(p->len < 4) return 0;


    len = unhex(p->data, 4);
    len = unhex(p->data, 4);
    if((len < 1) ||  (len > 1024)) {
    if ((len < 1) || (len > MAX_PAYLOAD_V1)) {
        D("SS(%d): bad size (%d)", s->id, len);
        D("SS(%d): bad size (%d)", s->id, len);
        goto fail;
        goto fail;
    }
    }