mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Client code - Bug 1234401 - check that the patch dir subdirectory is valid. r=mhowell
This commit is contained in:
parent
d83fb7cf3d
commit
35aaed5fff
@ -25,6 +25,8 @@
|
||||
#include "pathhash.h"
|
||||
#include "errors.h"
|
||||
|
||||
#define PATCH_DIR_PATH L"\\updates\\0"
|
||||
|
||||
// Wait 15 minutes for an update operation to run at most.
|
||||
// Updates usually take less than a minute so this seems like a
|
||||
// significantly large and safe amount of time to wait.
|
||||
@ -596,6 +598,20 @@ ExecuteServiceCommand(int argc, LPWSTR *argv)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// The patch directory path must end with updates\0 to use the maintenance
|
||||
// service.
|
||||
size_t fullPathLen = NS_tstrlen(argv[4]);
|
||||
size_t relPathLen = NS_tstrlen(PATCH_DIR_PATH);
|
||||
if (relPathLen > fullPathLen) {
|
||||
LOG_WARN(("The patch directory path length is not valid for this application."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (_wcsnicmp(argv[4] + fullPathLen - relPathLen, PATCH_DIR_PATH, relPathLen) != 0) {
|
||||
LOG_WARN(("The patch directory path subdirectory is not valid for this application."));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// This check is also performed in updater.cpp and is performed here
|
||||
// as well since the maintenance service can be called directly.
|
||||
if (argc < 5 || !IsValidFullPath(argv[5])) {
|
||||
|
Loading…
Reference in New Issue
Block a user