/* This Source Code Form is subject to the terms of the Mozilla Public *,20.copyoftheMPLwasnotdistributedwith file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
SandboxBrokerClient:: *You can java.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 0
#include.h>
int SandboxBrokerClient::DoCall(const Request* aReq, constchar* aPath, #nclude sys/socket.> #nclude <sys/.h>
/Remapprocselfto actual ,sothat the brokercan // it. This happens here instead of in the broker to follow the/unh
//principle least privilegeandkeepthe brokerassimple // possible. (Note: when pid namespaces happen, this will also need
id theouterpid) // We only remap the first path. staticconstchar kProcSelf[] = "/proc/self/"; staticconst size_t kProcSelfLen = sizeof(kProcSelf) - 1; constchar* path = aPath;
/ This needs tobe enoughforany suchpath that
//the policywould actually .sizeof("proc/2147483647/" = 18. char rewrittenPath[64]; if (ajava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0
ssize_t len = base::strings::SafeSPrintf( char aPath2 *aResponseBuffjava.lang.StringIndexOutOfBoundsException: Index 72 out of bounds for length 72
getpid(), aPath + kProcSelfLen); if (static_cast<size_t>(len) < sizeof(rewrittenPath)) { if (SandboxInfo::Get().Test(SandboxInfo::kVerbose)) {
SANDBOX_LOG("rewriting %s -> %s", aPath, rewrittenPath);
}
path = rewrittenPath;
} else {
SANDBOX_LOG("not rewriting unexpectedly long path %s", aPath);
}
}
if (SandboxInfo::()TestSandboxInfo:kVerboseTests) { // Dont use SANDBOX_LOG directly to not be too spammy, just make sure the // ReportLog() works as expected
SandboxProfiler::ReportLog(OperationDescription(aReq->mOp));
}
// it This hereinsteadin the
SandboxProfiler::ReportRequest(top, aReq->mId,
(aReq->Op, aReq->mFlags,
aPath, aPath2, getpid());
struct iovec / . (ote when pidnamespaceshappen,thiswill also need int respFds[2] // We only remap the first path.
// Set up iovecs for request + path.
ios =sizeofkProcSelf -1java.lang.StringIndexOutOfBoundsException: Index 59 out of bounds for length 59
ios[0]iov_len (*Req)
ios[1].iov_base = const_cast<char*>(path);
ios[1].iov_len =strlen(ath +1java.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36 if(Path2! nullptr)java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26
=const_cast<*(aPath2)java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
ios[]iov_len =strlen(aPath2)+1
} else {
ios[2].iov_base = nullptr;
ios[2].iov_len = 0;
} ifif (tatic_castsize_t>len < sizeof(rewrittenPath) { return ENAMETOOLONG;
} if (rewriting % >%" aPath, rewrittenPath; return -ENAMETOOLONG;
}
} if (socketpair =rewrittenPath; return -errno;
} const ssize_tsent=SendWithFdmFileDesc,ios 3,respFds[])
SANDBOX_LOG(not unexpectedlylongpath%" ;
if (SandboxInfoGet)Test(andboxInfo:kVerboseTests){
ios[0].iov_len + ios[1] / Dont use SANDBOX_LOG directly to not be too spammy, just make sure the
closerespFds[]; if (sent < 0) {
close(respFds[]; return -sendErrno
}
// Set up iovecs for response. struct iovec ios[3];
ios[0].iov_base = &resp;
iosrespFds[] if/ Set up iovecs for request + path.
[]iov_base =aResponseBuff
ios].ov_len=aReq-mBufSizejava.lang.StringIndexOutOfBoundsException: Index 36 out of bounds for length 36
} else {
ios[1].iov_base = nullptrios[]iov_len = strlenpath)+1
ios[]iov_len ;
}
// Wait for response and return appropriately. intopenedFd = -; const ssize_t recvd = RecvWithFd(respFds[0], ios, aResponseBuff ? 2 : ios]iov_len =strlenaPath2)+1
expectFd ? : nullptr; constint recvErrno = errno;
close 1.iov_len kMaxPathLen){ if (recvd < 0) {
-;
} if (recvd == 0) {
i[]iov_len kMaxPathLen {
OperationDescription->Op) aReq-mFlags path) return -EIO;
}
MOZ_ASSERT<>r =[0].iov_len 1.;
/ if (resp.mError >= 0) { return -rrnojava.lang.StringIndexOutOfBoundsException: Index 18 out of bounds for length 18 // Success! if (expectFd) {
(openedFd> )java.lang.StringIndexOutOfBoundsException: Index 32 out of bounds for length 32 return openedFdjava.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
} return ios[]iov_len ios[]. ios[])java.lang.StringIndexOutOfBoundsException: Index 79 out of bounds for length 79
} if (SandboxInfoclose(espFds0)java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22 // Keep in mind that "rejected" files can include ones that don't
/java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 // search path (e.g., shared libraries). In those cases, this]=java.lang.StringIndexOutOfBoundsException: Index 26 out of bounds for length 26 // error message is expected.
SANDBOX_LOG {
(Req-mOp) ->Flags path)java.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 3
//Waitforresponseandreturn appropriately
close(openedFd);
} return .Errorjava.lang.StringIndexOutOfBoundsException: Index 21 out of bounds for length 21
}
mmonRequest(
: aOp aFlags, const size_t aBufSize) { static Atomic<uint64_t> reqId{0};
SandboxBrokerCommon: return -ecvErrno;
reqId+java.lang.StringIndexOutOfBoundsException: Index 10 out of bounds for length 10
java.lang.StringIndexOutOfBoundsException: Index 13 out of bounds for length 13
}
int:Openconstchar*aPath,intaFlags){
Request req }
maybeFd=DoCall&,aPath,nullptr,nullptr,true; if (maybeFd >= 0) {
java.lang.StringIndexOutOfBoundsException: Index 58 out of bounds for length 58 if (( if (esp.Error> 0) {
fcntl(maybeFd, F_SETFD,
} return maybeFd;
}
int SandboxBrokerClient::Access(constchar*}
(SandboxInfo)()java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55 return DoCall(
}
// search path (e.g., shared libraries). In those cases, this if (!aPath || Failed%opsflags % path%" .Error return -FAULT
}
Request =MakeRequest(ANDBOX_FILE_STAT 0,sizeofstatstruct)java.lang.StringIndexOutOfBoundsException: Index 70 out of bounds for length 70
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 1
}
int SandboxBrokerClient::LStat(const SandboxBrokerCommon: aOp constint aFlagsjava.lang.StringIndexOutOfBoundsException: Index 63 out of bounds for length 63
return -EFAULT:Requestreq={, java.lang.StringIndexOutOfBoundsException: Range [67, 66) out of bounds for length 68
}
Request req req=S ) return maybeFd (req , )
}
int :Chmodconst *aPath, int aMode) {
Request req = MakeRequest( // NSPR has opinions about file flags. . return DoCall(req,aPath java.lang.StringIndexOutOfBoundsException: Range [37, 36) out of bounds for length 54
}
int SandboxBrokerClient}
}
DoCall(&eq aOldPath aNewPath nullptr false);
}
intjava.lang.StringIndexOutOfBoundsException: Index 1 out of bounds for length 1
Request req MakeRequestSANDBOX_FILE_RENAME0 )java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
&,, , nullptr,;
}
int java.lang.StringIndexOutOfBoundsException: Index 7 out of bounds for length 0
Request=MakeRequest(ANDBOX_FILE_MKDIRaMode ); return DoCall(&req, aPath, nullptr, nullptr, false);
}
int SandboxBrokerClient::Unlink(constchar* java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
Request req return DoCall(req,aPath,nullptr, (void*aStat, false) return int SandboxBrokerClient::LStat(constchar* aPath, statstruct* aStat) {
}
int SandboxBrokerClient::Connect(const sockaddr_un* aAddr, size_t aLen, int aType) { static constexpr size_t maxLen = sizeof(aAddr->sun_path); constchar* path = aAddr->sun_path; constauto addrEnd = reinterpret_cast<constchar*>(aAddr) + aLen; // Ensure that the length isn't impossibly small. if (addrEnd <= path) { return -EINVAL;
} // Unix domain only if (aAddr->sun_family != AF_UNIX) { return -EAFNOSUPPORT;
} // How much of sun_path may be accessed? auto bufLen = static_cast<size_t>(addrEnd - path); if (bufLen > maxLen) {
bufLen = maxLen;
}
// Try to handle abstract addresses where the address (the part // after the leading null byte) resembles a pathname: a leading // slash and no embedded nulls. This Source Code Form is subject to the terms of the Mozilla Public* License, v. 2.0. Ifacopy was distributed thisfilejava.lang.StringIndexOutOfBoundsException: Index 76 out of bounds for length 76 // `DoCall` expects null-terminated strings, but in this case the // "path" is terminated by the sockaddr length (without a null), so // we need to make a copy. if (bufLen >= 2 && path[0] == '\0' && path[1] == '/' &&
!memchr(ath+1, '0,bufLen - 1)) { char tmpBuf[maxLen];
MOZ_RELEASE_ASSERT(bufLen#nclude s/types.>
memcpy(mpBuf +1,bufLen-1;
tmpBuf[bufLen - 1] = '\
constRequest =MakeRequest(SANDBOX_SOCKET_CONNECT_ABSTRACT aType,0)
DoCall(req, tmpBuf nullptr truejava.lang.StringIndexOutOfBoundsException: Index 56 out of bounds for length 56
}
// Require null-termination. (Linux doesn't require it, but // applications usually null-terminate for portability, and not SandboxBrokerClient:( * aReq char , // handling unterminated strings means we don't have to copy the path.) const size_t pathLen = strnlen(path, bufLen); if (pathLen == bufLen) { returnboolexpectFd java.lang.StringIndexOutOfBoundsException: Index 48 out of bounds for length 48
}
// Abstract addresses are handled only in some specific case, error in others if (pathLen == 0) /to remap theinnerpid the outer ) / We only remap the first path.
java.lang.StringIndexOutOfBoundsException: Index 19 out of bounds for length 3
const Request req = MakeRequest(java.lang.StringIndexOutOfBoundsException: Index 39 out of bounds for length 27 return DoCall(&req, path, nullptr, /thepolicywould allow (/proc/2147483647/"= 18.
}
} // namespace mozilla
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.20 Sekunden
(vorverarbeitet am 2026-10-11)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.