зеркало из https://github.com/mozilla/gecko-dev.git
Bug 848417 - Use wcsncpy instead of wcscpy. r=bbondy
This commit is contained in:
Родитель
fd3ca84ce7
Коммит
ee782cf10f
|
@ -47,8 +47,8 @@ static BOOL
|
||||||
IsStatusApplying(LPCWSTR updateDirPath, BOOL &isApplying)
|
IsStatusApplying(LPCWSTR updateDirPath, BOOL &isApplying)
|
||||||
{
|
{
|
||||||
isApplying = FALSE;
|
isApplying = FALSE;
|
||||||
WCHAR updateStatusFilePath[MAX_PATH + 1];
|
WCHAR updateStatusFilePath[MAX_PATH + 1] = {L'\0'};
|
||||||
wcscpy(updateStatusFilePath, updateDirPath);
|
wcsncpy(updateStatusFilePath, updateDirPath, MAX_PATH);
|
||||||
if (!PathAppendSafe(updateStatusFilePath, L"update.status")) {
|
if (!PathAppendSafe(updateStatusFilePath, L"update.status")) {
|
||||||
LOG_WARN(("Could not append path for update.status file"));
|
LOG_WARN(("Could not append path for update.status file"));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -102,12 +102,12 @@ IsUpdateBeingStaged(int argc, LPWSTR *argv)
|
||||||
* @param aResultDir Buffer to hold the installation directory.
|
* @param aResultDir Buffer to hold the installation directory.
|
||||||
*/
|
*/
|
||||||
static BOOL
|
static BOOL
|
||||||
GetInstallationDir(int argcTmp, LPWSTR *argvTmp, WCHAR aResultDir[MAX_PATH])
|
GetInstallationDir(int argcTmp, LPWSTR *argvTmp, WCHAR aResultDir[MAX_PATH + 1])
|
||||||
{
|
{
|
||||||
if (argcTmp < 2) {
|
if (argcTmp < 2) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
wcscpy(aResultDir, argvTmp[2]);
|
wcsncpy(aResultDir, argvTmp[2], MAX_PATH);
|
||||||
WCHAR* backSlash = wcsrchr(aResultDir, L'\\');
|
WCHAR* backSlash = wcsrchr(aResultDir, L'\\');
|
||||||
// Make sure that the path does not include trailing backslashes
|
// Make sure that the path does not include trailing backslashes
|
||||||
if (backSlash && (backSlash[1] == L'\0')) {
|
if (backSlash && (backSlash[1] == L'\0')) {
|
||||||
|
@ -304,7 +304,7 @@ ProcessSoftwareUpdateCommand(DWORD argc, LPWSTR *argv)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
WCHAR installDir[MAX_PATH] = {L'\0'};
|
WCHAR installDir[MAX_PATH + 1] = {L'\0'};
|
||||||
if (!GetInstallationDir(argc, argv, installDir)) {
|
if (!GetInstallationDir(argc, argv, installDir)) {
|
||||||
LOG_WARN(("Could not get the installation directory"));
|
LOG_WARN(("Could not get the installation directory"));
|
||||||
if (!WriteStatusFailure(argv[1],
|
if (!WriteStatusFailure(argv[1],
|
||||||
|
|
Загрузка…
Ссылка в новой задаче