Bug 1079655: Ensure that the path used to load XPCOM can be sanitized on OSX 10.10. r=spohl

This commit is contained in:
Jean-Yves Avenard 2014-10-09 12:34:04 +11:00
parent dc39cb9054
commit 1db5266dde

View File

@ -56,9 +56,8 @@ private:
return NS_ERROR_FAILURE;
}
UInt8 tempBuffer[MAXPATHLEN];
nsresult rv;
if (CFURLGetFileSystemRepresentation(executableURL, false, tempBuffer,
if (CFURLGetFileSystemRepresentation(executableURL, false, (UInt8*)aResult,
MAXPATHLEN)) {
rv = NS_OK;
} else {
@ -69,11 +68,11 @@ private:
// for example.
size_t readPos = 0;
size_t writePos = 0;
while (tempBuffer[readPos] != '\0') {
if (tempBuffer[readPos] == '.' && tempBuffer[readPos + 1] == '/') {
while (aResult[readPos] != '\0') {
if (aResult[readPos] == '.' && aResult[readPos + 1] == '/') {
readPos += 2;
}
aResult[writePos] = tempBuffer[readPos];
aResult[writePos] = aResult[readPos];
readPos++;
writePos++;
}