summaryrefslogtreecommitdiffstats
path: root/sandbox/src
diff options
context:
space:
mode:
authorwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 17:45:43 +0000
committerwtc@chromium.org <wtc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-23 17:45:43 +0000
commit035bcb7fa5b3ac93971a832725c4a4815ba86fd2 (patch)
treef6b5941ee12b199e13363b10244277a0e9829efa /sandbox/src
parentdcf998001a3742efd7b52ee73a44f47dcce97c58 (diff)
downloadchromium_src-035bcb7fa5b3ac93971a832725c4a4815ba86fd2.zip
chromium_src-035bcb7fa5b3ac93971a832725c4a4815ba86fd2.tar.gz
chromium_src-035bcb7fa5b3ac93971a832725c4a4815ba86fd2.tar.bz2
Fix a FORWARD_NULL defect in ExtractModuleName reported by Coverity.
If 'sep' is still NULL after the for loop, ix must be -1, so ix == 0 cannot be true. Update the comment for ExtractModuleName in the header to match the implementation. I don't see any code that checks whether the path is a full path. R=rvargas BUG=http://crbug.com/17101 TEST=none Review URL: http://codereview.chromium.org/155979 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21404 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sandbox/src')
-rw-r--r--sandbox/src/sandbox_nt_util.cc5
-rw-r--r--sandbox/src/sandbox_nt_util.h6
2 files changed, 5 insertions, 6 deletions
diff --git a/sandbox/src/sandbox_nt_util.cc b/sandbox/src/sandbox_nt_util.cc
index ae5556e..e8a56a7 100644
--- a/sandbox/src/sandbox_nt_util.cc
+++ b/sandbox/src/sandbox_nt_util.cc
@@ -301,7 +301,6 @@ UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32* flags) {
if (headers->OptionalHeader.SizeOfCode)
*flags |= MODULE_HAS_CODE;
}
-
} while (false);
} __except(EXCEPTION_EXECUTE_HANDLER) {
}
@@ -349,7 +348,7 @@ UNICODE_STRING* ExtractModuleName(const UNICODE_STRING* module_path) {
int start_pos = module_path->Length / sizeof(wchar_t) - 1;
int ix = start_pos;
- for(; ix >= 0; --ix) {
+ for (; ix >= 0; --ix) {
if (module_path->Buffer[ix] == L'\\') {
sep = &module_path->Buffer[ix];
break;
@@ -361,7 +360,7 @@ UNICODE_STRING* ExtractModuleName(const UNICODE_STRING* module_path) {
return NULL;
// No path separator found. Use the entire name.
- if ((ix == 0) && !sep) {
+ if (!sep) {
sep = &module_path->Buffer[-1];
}
diff --git a/sandbox/src/sandbox_nt_util.h b/sandbox/src/sandbox_nt_util.h
index f979a0d..87d2409 100644
--- a/sandbox/src/sandbox_nt_util.h
+++ b/sandbox/src/sandbox_nt_util.h
@@ -118,9 +118,9 @@ UNICODE_STRING* GetImageInfoFromModule(HMODULE module, uint32* flags);
UNICODE_STRING* GetBackingFilePath(PVOID address);
// Returns the last component of a path that contains the module name.
-// It will return NULL if the path is not a full path or if the path ends
-// with the path separator. The returned buffer must be freed with a placement
-// delete (see GetImageNameFromModule example).
+// It will return NULL if the path ends with the path separator. The returned
+// buffer must be freed with a placement delete (see GetImageNameFromModule
+// example).
UNICODE_STRING* ExtractModuleName(const UNICODE_STRING* module_path);
// Returns true if the parameters correspond to a dll mapped as code.