Flawfinder version 2.0.10, (C) 2001-2019 David A. Wheeler. Number of rules (primarily dangerous function names) in C/C++ ruleset: 223 Examining data/enblend-enfuse-4.2/doc/examples/enfuse/templated_power.cc Examining data/enblend-enfuse-4.2/doc/examples/enfuse/sinc.cc Examining data/enblend-enfuse-4.2/doc/examples/enfuse/variable_power.cc Examining data/enblend-enfuse-4.2/doc/examples/enfuse/fixed_power.cc Examining data/enblend-enfuse-4.2/doc/examples/enfuse/linear.cc Examining data/enblend-enfuse-4.2/doc/examples/enfuse/tabular.cc Examining data/enblend-enfuse-4.2/src/enblend.cc Examining data/enblend-enfuse-4.2/src/enblend.h Examining data/enblend-enfuse-4.2/src/win32helpers/getopt.c Examining data/enblend-enfuse-4.2/src/win32helpers/getopt.h Examining data/enblend-enfuse-4.2/src/anneal.h Examining data/enblend-enfuse-4.2/src/mga.h Examining data/enblend-enfuse-4.2/src/dynamic_loader/null_implementation.h Examining data/enblend-enfuse-4.2/src/dynamic_loader/dynamic_loader.h Examining data/enblend-enfuse-4.2/src/dynamic_loader/dynamic_loader.cc Examining data/enblend-enfuse-4.2/src/dynamic_loader/win32_implementation.cc Examining data/enblend-enfuse-4.2/src/dynamic_loader/posix_implementation.h Examining data/enblend-enfuse-4.2/src/dynamic_loader/posix_implementation.cc Examining data/enblend-enfuse-4.2/src/dynamic_loader/dynamic_loader_implementation.cc Examining data/enblend-enfuse-4.2/src/dynamic_loader/dynamic_loader_implementation.h Examining data/enblend-enfuse-4.2/src/dynamic_loader/gmodule_implementation.cc Examining data/enblend-enfuse-4.2/src/dynamic_loader/win32_implementation.h Examining data/enblend-enfuse-4.2/src/dynamic_loader/gmodule_implementation.h Examining data/enblend-enfuse-4.2/src/filespec.cc Examining data/enblend-enfuse-4.2/src/parameter.cc Examining data/enblend-enfuse-4.2/src/postoptimizer.h Examining data/enblend-enfuse-4.2/src/alternativepercentage.h Examining data/enblend-enfuse-4.2/src/assemble.h Examining data/enblend-enfuse-4.2/src/mersenne.cc Examining data/enblend-enfuse-4.2/src/pyramid.h Examining data/enblend-enfuse-4.2/src/layer_selection/selector.cc Parsing failed to find end of parameter list; semicolon terminated it in (token->begin(), token->end(), reverse_keyword.begin(), [](std::string::value_type v1, std::string::value_type v2) {return tolower(v1) == to Examining data/enblend-enfuse-4.2/src/layer_selection/selector.h Examining data/enblend-enfuse-4.2/src/layer_selection/info.h Examining data/enblend-enfuse-4.2/src/layer_selection/info.cc Examining data/enblend-enfuse-4.2/src/layer_selection/layer_selection.cc Examining data/enblend-enfuse-4.2/src/layer_selection/layer_selection.h Examining data/enblend-enfuse-4.2/src/self_test.cc Examining data/enblend-enfuse-4.2/src/self_test.h Examining data/enblend-enfuse-4.2/src/introspection.h Examining data/enblend-enfuse-4.2/src/exposure_weight.cc Examining data/enblend-enfuse-4.2/src/global.h Examining data/enblend-enfuse-4.2/src/enfuse.h Examining data/enblend-enfuse-4.2/src/timer.h Examining data/enblend-enfuse-4.2/src/common.h Examining data/enblend-enfuse-4.2/src/introspection.cc Examining data/enblend-enfuse-4.2/src/opencl.cc Examining data/enblend-enfuse-4.2/src/openmp_vigra.h Examining data/enblend-enfuse-4.2/src/filespec.h Examining data/enblend-enfuse-4.2/src/parameter.h Examining data/enblend-enfuse-4.2/src/mersenne.h Examining data/enblend-enfuse-4.2/src/mask.h Examining data/enblend-enfuse-4.2/src/muopt.h Examining data/enblend-enfuse-4.2/src/path.h Examining data/enblend-enfuse-4.2/src/tiff_message.h Examining data/enblend-enfuse-4.2/src/error_message.cc Examining data/enblend-enfuse-4.2/src/numerictraits.h Examining data/enblend-enfuse-4.2/src/opencl.h Examining data/enblend-enfuse-4.2/src/opencl_vigra.h Examining data/enblend-enfuse-4.2/src/error_message.h Examining data/enblend-enfuse-4.2/src/opencl_anneal.h Examining data/enblend-enfuse-4.2/src/filenameparse.cc Examining data/enblend-enfuse-4.2/src/maskcommon.h Examining data/enblend-enfuse-4.2/src/nearest.h Examining data/enblend-enfuse-4.2/src/enfuse.cc Examining data/enblend-enfuse-4.2/src/openmp_lock.h Examining data/enblend-enfuse-4.2/src/timer.cc Examining data/enblend-enfuse-4.2/src/blend.h Examining data/enblend-enfuse-4.2/src/fixmath.h Examining data/enblend-enfuse-4.2/src/graphcut.h Examining data/enblend-enfuse-4.2/src/opencl_exposure_weight.h Examining data/enblend-enfuse-4.2/src/exposure_weight_base.h Examining data/enblend-enfuse-4.2/src/alternativepercentage.cc Examining data/enblend-enfuse-4.2/src/opencl_exposure_weight.cc Examining data/enblend-enfuse-4.2/src/exposure_weight.h Examining data/enblend-enfuse-4.2/src/minimizer.h Examining data/enblend-enfuse-4.2/src/openmp_def.h Examining data/enblend-enfuse-4.2/src/filenameparse.h Examining data/enblend-enfuse-4.2/src/bounds.h Examining data/enblend-enfuse-4.2/src/tiff_message.cc Examining data/enblend-enfuse-4.2/src/masktypedefs.h Examining data/enblend-enfuse-4.2/src/minimizer.cc FINAL RESULTS: data/enblend-enfuse-4.2/src/mga.h:105:21: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. if (sscanf(name.c_str(), data/enblend-enfuse-4.2/src/opencl.cc:1012:34: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. size_t actual_size = vsnprintf(buffer, buffer_size, a_format_string, a_variable_argument_list); data/enblend-enfuse-4.2/src/tiff_message.cc:48:5: [4] (format) vsnprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. vsnprintf(&message[0], buffer_size, format, arguments); data/enblend-enfuse-4.2/src/dynamic_loader/win32_implementation.cc:41:15: [3] (misc) LoadLibrary: Ensure that the full path to the library is specified, or current directory may be used (CWE-829, CWE-20). Use registry entry or GetWindowsDirectory to find library path, if you aren't already. handle_ = LoadLibrary(library_name().c_str()); data/enblend-enfuse-4.2/src/enblend.cc:878:26: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. const int code = getopt_long(argc, argv, short_options, long_options, &option_index); data/enblend-enfuse-4.2/src/enfuse.cc:1011:26: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. const int code = getopt_long(argc, argv, short_options, data/enblend-enfuse-4.2/src/fixmath.h:240:17: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. if (random <= vFraction) data/enblend-enfuse-4.2/src/introspection.cc:84:38: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* tmpdir = getenv("TMPDIR"); data/enblend-enfuse-4.2/src/opencl.cc:484:13: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if (getenv(OPENCL_PATH)) data/enblend-enfuse-4.2/src/opencl.cc:486:29: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. paths.push_back(getenv(OPENCL_PATH)); data/enblend-enfuse-4.2/src/opencl.cc:890:28: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. const char* home = getenv("HOME"); data/enblend-enfuse-4.2/src/self_test.cc:95:20: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int code = getopt_long(arg_count, const_cast<char* const*>(arguments), data/enblend-enfuse-4.2/src/win32helpers/getopt.c:201:7: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. char *getenv (); data/enblend-enfuse-4.2/src/win32helpers/getopt.c:378:16: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. else if (getenv ("POSIXLY_CORRECT") != NULL) data/enblend-enfuse-4.2/src/win32helpers/getopt.c:678:1: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. getopt (int argc, char *const *argv, const char *optstring) data/enblend-enfuse-4.2/src/win32helpers/getopt.c:680:1: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. getopt (argc, argv, optstring) data/enblend-enfuse-4.2/src/win32helpers/getopt.c:692:5: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. int getopt_long (int argc, char *const *argv, const char *shortopts, data/enblend-enfuse-4.2/src/win32helpers/getopt.c:721:11: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. c = getopt (argc, argv, "abc:d:0123456789"); data/enblend-enfuse-4.2/src/win32helpers/getopt.h:102:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt (int argc, char *const *argv, const char *shortopts); data/enblend-enfuse-4.2/src/win32helpers/getopt.h:104:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt (); data/enblend-enfuse-4.2/src/win32helpers/getopt.h:106:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long (int argc, char *const *argv, const char *shortopts, data/enblend-enfuse-4.2/src/win32helpers/getopt.h:118:12: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt (); data/enblend-enfuse-4.2/src/win32helpers/getopt.h:119:12: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. extern int getopt_long (); data/enblend-enfuse-4.2/src/common.h:751:91: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). std::setw(width.empty() ? 1U + ilog10(aNumberOfImages - 1U) : atoi(width.c_str())) << data/enblend-enfuse-4.2/src/dynamic_loader/dynamic_loader.cc:45:22: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). implementation_->open(); data/enblend-enfuse-4.2/src/dynamic_loader/dynamic_loader.cc:52:22: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). implementation_->open(); data/enblend-enfuse-4.2/src/dynamic_loader/dynamic_loader_implementation.h:39:18: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). virtual void open() = 0; data/enblend-enfuse-4.2/src/dynamic_loader/gmodule_implementation.cc:34:34: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). GLibDynamicLoaderImplementation::open() data/enblend-enfuse-4.2/src/dynamic_loader/gmodule_implementation.h:39:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void open(); data/enblend-enfuse-4.2/src/dynamic_loader/null_implementation.h:40:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void open() {} data/enblend-enfuse-4.2/src/dynamic_loader/posix_implementation.cc:34:35: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). PosixDynamicLoaderImplementation::open() data/enblend-enfuse-4.2/src/dynamic_loader/posix_implementation.h:39:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void open(); data/enblend-enfuse-4.2/src/dynamic_loader/win32_implementation.cc:35:33: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). WinDynamicLoaderImplementation::open() data/enblend-enfuse-4.2/src/dynamic_loader/win32_implementation.h:41:10: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). void open(); data/enblend-enfuse-4.2/src/enblend.cc:2278:17: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&white_point, cmsD50_xyY(), sizeof(cmsCIExyY)); data/enblend-enfuse-4.2/src/enfuse.cc:2482:17: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&white_point, cmsD50_xyY(), sizeof(cmsCIExyY)); data/enblend-enfuse-4.2/src/filespec.cc:178:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char drive[_MAX_DRIVE]; data/enblend-enfuse-4.2/src/filespec.cc:179:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char dir[_MAX_DIR]; data/enblend-enfuse-4.2/src/filespec.cc:180:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char fname[_MAX_FNAME]; data/enblend-enfuse-4.2/src/filespec.cc:181:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char ext[_MAX_EXT]; data/enblend-enfuse-4.2/src/filespec.cc:182:5: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char newFile[_MAX_PATH]; data/enblend-enfuse-4.2/src/introspection.cc:77:17: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char lpPathBuffer[MAX_PATH]; data/enblend-enfuse-4.2/src/opencl.cc:491:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char buffer[MAX_PATH]; //always use MAX_PATH for filepaths data/enblend-enfuse-4.2/src/opencl.cc:1316:13: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy(&(*r)[0], *b, *s); data/enblend-enfuse-4.2/src/pyramid.h:1801:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filenameBuf[512]; data/enblend-enfuse-4.2/src/pyramid.h:1833:9: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char filenameBuf[512]; data/enblend-enfuse-4.2/src/win32helpers/getopt.c:195:31: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. #define my_bcopy(src, dst, n) memcpy ((dst), (src), (n)) data/enblend-enfuse-4.2/src/layer_selection/selector.cc:513:22: [1] (buffer) mismatch: Function does not check the second iterator for over-read conditions (CWE-126). This function is often discouraged by most C++ coding standards in favor of its safer alternatives provided since C++14. Consider using a form of this function that checks the second iterator before potentially overflowing it. std::mismatch(token->begin(), token->end(), reverse_keyword.begin(), data/enblend-enfuse-4.2/src/opencl.cc:833:57: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). {return strncasecmp(a_prefix, name.c_str(), strlen(a_prefix)) == 0;}; data/enblend-enfuse-4.2/src/win32helpers/getopt.c:486:37: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if ((size_t) (s - nextchar) == strlen (p->name)) data/enblend-enfuse-4.2/src/win32helpers/getopt.c:510:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/enblend-enfuse-4.2/src/win32helpers/getopt.c:540:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/enblend-enfuse-4.2/src/win32helpers/getopt.c:553:17: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); data/enblend-enfuse-4.2/src/win32helpers/getopt.c:557:16: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). nextchar += strlen (nextchar); ANALYSIS SUMMARY: Hits = 54 Lines analyzed = 33426 in approximately 0.77 seconds (43245 lines/second) Physical Source Lines of Code (SLOC) = 24725 Hits@level = [0] 26 [1] 7 [2] 24 [3] 20 [4] 3 [5] 0 Hits@level+ = [0+] 80 [1+] 54 [2+] 47 [3+] 23 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 3.23559 [1+] 2.18402 [2+] 1.90091 [3+] 0.930233 [4+] 0.121335 [5+] 0 Dot directories skipped = 1 (--followdotdir overrides) Minimum risk level = 1 Not every hit is necessarily a security vulnerability. There may be other security vulnerabilities; review your code! See 'Secure Programming HOWTO' (https://dwheeler.com/secure-programs) for more information.