mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
make processing of installed-chrome more robust. bugs 38198, 40186
This commit is contained in:
parent
fe6fac7c85
commit
afa832a154
@ -2090,23 +2090,39 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
|
||||
nsCAutoString fileURL;
|
||||
nsCAutoString chromeURL;
|
||||
|
||||
static const char *delim = ",\r\n";
|
||||
|
||||
chromeType = strtok(aBuffer, delim);
|
||||
do {
|
||||
while (aBuffer < bufferEnd) {
|
||||
// parse one line of installed-chrome.txt
|
||||
if (!chromeType)
|
||||
break;
|
||||
chromeProfile = strtok(0, delim);
|
||||
if (!chromeProfile || chromeProfile > bufferEnd)
|
||||
break;
|
||||
chromeLocType = strtok(0, delim);
|
||||
if (!chromeLocType || chromeProfile > bufferEnd)
|
||||
break;
|
||||
chromeLocation = strtok(0, delim);
|
||||
if (!chromeLocation || chromeProfile > bufferEnd)
|
||||
chromeType = aBuffer;
|
||||
while (aBuffer < bufferEnd && *aBuffer != ',')
|
||||
++aBuffer;
|
||||
if (aBuffer >= bufferEnd)
|
||||
break;
|
||||
*aBuffer = '\0';
|
||||
|
||||
chromeProfile = ++aBuffer;
|
||||
while (aBuffer < bufferEnd && *aBuffer != ',')
|
||||
++aBuffer;
|
||||
if (aBuffer >= bufferEnd)
|
||||
break;
|
||||
*aBuffer = '\0';
|
||||
|
||||
chromeLocType = ++aBuffer;
|
||||
while (aBuffer < bufferEnd && *aBuffer != ',')
|
||||
++aBuffer;
|
||||
if (aBuffer >= bufferEnd)
|
||||
break;
|
||||
*aBuffer = '\0';
|
||||
|
||||
chromeLocation = ++aBuffer;
|
||||
while (aBuffer < bufferEnd && (*aBuffer != '\r' && *aBuffer != '\n'))
|
||||
++aBuffer;
|
||||
if (aBuffer >= bufferEnd)
|
||||
break;
|
||||
while (*--aBuffer == ' ')
|
||||
;
|
||||
*++aBuffer = '\0';
|
||||
|
||||
// process the parsed line
|
||||
isProfile = profile.Equals(chromeProfile);
|
||||
|
||||
if (path.Equals(chromeLocType)) {
|
||||
@ -2132,8 +2148,9 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
|
||||
else if (locale.Equals(chromeType))
|
||||
InstallLocale(chromeURL, isProfile);
|
||||
|
||||
chromeType = strtok(0, delim);
|
||||
} while (chromeType < bufferEnd);
|
||||
while (aBuffer < bufferEnd && (*aBuffer == '\0' || *aBuffer == ' ' || *aBuffer == '\r' || *aBuffer == '\n'))
|
||||
++aBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
@ -2090,23 +2090,39 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
|
||||
nsCAutoString fileURL;
|
||||
nsCAutoString chromeURL;
|
||||
|
||||
static const char *delim = ",\r\n";
|
||||
|
||||
chromeType = strtok(aBuffer, delim);
|
||||
do {
|
||||
while (aBuffer < bufferEnd) {
|
||||
// parse one line of installed-chrome.txt
|
||||
if (!chromeType)
|
||||
break;
|
||||
chromeProfile = strtok(0, delim);
|
||||
if (!chromeProfile || chromeProfile > bufferEnd)
|
||||
break;
|
||||
chromeLocType = strtok(0, delim);
|
||||
if (!chromeLocType || chromeProfile > bufferEnd)
|
||||
break;
|
||||
chromeLocation = strtok(0, delim);
|
||||
if (!chromeLocation || chromeProfile > bufferEnd)
|
||||
chromeType = aBuffer;
|
||||
while (aBuffer < bufferEnd && *aBuffer != ',')
|
||||
++aBuffer;
|
||||
if (aBuffer >= bufferEnd)
|
||||
break;
|
||||
*aBuffer = '\0';
|
||||
|
||||
chromeProfile = ++aBuffer;
|
||||
while (aBuffer < bufferEnd && *aBuffer != ',')
|
||||
++aBuffer;
|
||||
if (aBuffer >= bufferEnd)
|
||||
break;
|
||||
*aBuffer = '\0';
|
||||
|
||||
chromeLocType = ++aBuffer;
|
||||
while (aBuffer < bufferEnd && *aBuffer != ',')
|
||||
++aBuffer;
|
||||
if (aBuffer >= bufferEnd)
|
||||
break;
|
||||
*aBuffer = '\0';
|
||||
|
||||
chromeLocation = ++aBuffer;
|
||||
while (aBuffer < bufferEnd && (*aBuffer != '\r' && *aBuffer != '\n'))
|
||||
++aBuffer;
|
||||
if (aBuffer >= bufferEnd)
|
||||
break;
|
||||
while (*--aBuffer == ' ')
|
||||
;
|
||||
*++aBuffer = '\0';
|
||||
|
||||
// process the parsed line
|
||||
isProfile = profile.Equals(chromeProfile);
|
||||
|
||||
if (path.Equals(chromeLocType)) {
|
||||
@ -2132,8 +2148,9 @@ nsChromeRegistry::ProcessNewChromeBuffer(char *aBuffer, PRInt32 aLength) {
|
||||
else if (locale.Equals(chromeType))
|
||||
InstallLocale(chromeURL, isProfile);
|
||||
|
||||
chromeType = strtok(0, delim);
|
||||
} while (chromeType < bufferEnd);
|
||||
while (aBuffer < bufferEnd && (*aBuffer == '\0' || *aBuffer == ' ' || *aBuffer == '\r' || *aBuffer == '\n'))
|
||||
++aBuffer;
|
||||
}
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user