Move safe_search to globals and add LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR to the list of safe flags
This commit is contained in:
parent
bd3787e2bc
commit
49fd4b2ec9
11
flawfinder
11
flawfinder
|
@ -846,13 +846,13 @@ def cpp_unsafe_stl(hit):
|
||||||
if len(hit.parameters) <= 4:
|
if len(hit.parameters) <= 4:
|
||||||
add_warning(hit)
|
add_warning(hit)
|
||||||
|
|
||||||
def load_library_ex(hit):
|
safe_load_library_flags = [
|
||||||
# If parameter 3 has one of the flags below, it's safe.
|
|
||||||
safe_search = [
|
|
||||||
# Load only from the folder where the .exe file is located
|
# Load only from the folder where the .exe file is located
|
||||||
'LOAD_LIBRARY_SEARCH_APPLICATION_DIR',
|
'LOAD_LIBRARY_SEARCH_APPLICATION_DIR',
|
||||||
# Combination of application, System32 and user directories
|
# Combination of application, System32 and user directories
|
||||||
'LOAD_LIBRARY_SEARCH_DEFAULT_DIRS',
|
'LOAD_LIBRARY_SEARCH_DEFAULT_DIRS',
|
||||||
|
# This flag requires an absolute path to the DLL to be passed
|
||||||
|
'LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR',
|
||||||
# Load only from System32
|
# Load only from System32
|
||||||
'LOAD_LIBRARY_SEARCH_SYSTEM32',
|
'LOAD_LIBRARY_SEARCH_SYSTEM32',
|
||||||
# Load only from directories specified with AddDllDirectory
|
# Load only from directories specified with AddDllDirectory
|
||||||
|
@ -862,8 +862,11 @@ def load_library_ex(hit):
|
||||||
# the current directory is part of the safe load list
|
# the current directory is part of the safe load list
|
||||||
'LOAD_LIBRARY_SAFE_CURRENT_DIRS'
|
'LOAD_LIBRARY_SAFE_CURRENT_DIRS'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def load_library_ex(hit):
|
||||||
|
# If parameter 3 has one of the flags below, it's safe.
|
||||||
if (len(hit.parameters) >= 4 and
|
if (len(hit.parameters) >= 4 and
|
||||||
any(flag in hit.parameters[3] for flag in safe_search)):
|
any(flag in hit.parameters[3] for flag in safe_load_library_flags)):
|
||||||
return
|
return
|
||||||
normal(hit)
|
normal(hit)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue