Bug 1079655: Do not sanitize the path used to load XPCOM if the path couldn't

be retrieved successfully on OSX. r=spohl
This commit is contained in:
Jean-Yves Avenard 2014-10-09 12:19:45 +11:00
parent 1db5266dde
commit e22e48bca9

View File

@ -59,25 +59,25 @@ private:
nsresult rv;
if (CFURLGetFileSystemRepresentation(executableURL, false, (UInt8*)aResult,
MAXPATHLEN)) {
// Sanitize path in case the app was launched from Terminal via
// './firefox' for example.
size_t readPos = 0;
size_t writePos = 0;
while (aResult[readPos] != '\0') {
if (aResult[readPos] == '.' && aResult[readPos + 1] == '/') {
readPos += 2;
} else {
aResult[writePos] = aResult[readPos];
readPos++;
writePos++;
}
}
aResult[writePos] = '\0';
rv = NS_OK;
} else {
rv = NS_ERROR_FAILURE;
}
// Sanitize path in case the app was launched from Terminal via './firefox'
// for example.
size_t readPos = 0;
size_t writePos = 0;
while (aResult[readPos] != '\0') {
if (aResult[readPos] == '.' && aResult[readPos + 1] == '/') {
readPos += 2;
}
aResult[writePos] = aResult[readPos];
readPos++;
writePos++;
}
aResult[writePos] = '\0';
CFRelease(executableURL);
return rv;
}