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/dh-exec-0.23.2/src/dh-exec-install.c Examining data/dh-exec-0.23.2/src/dh-exec.c Examining data/dh-exec-0.23.2/src/dh-exec.lib.c Examining data/dh-exec-0.23.2/src/dh-exec.lib.h Examining data/dh-exec-0.23.2/src/dh-exec.simple.c FINAL RESULTS: data/dh-exec-0.23.2/src/dh-exec.c:324:15: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access (path, R_OK | X_OK) != 0) data/dh-exec-0.23.2/src/dh-exec.lib.c:133:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. r = access (path, X_OK); data/dh-exec-0.23.2/src/dh-exec.c:242:11: [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. c = getopt_long (argc, argv, "hI:i:X:vnl", dhe_options, &option_index); data/dh-exec-0.23.2/src/dh-exec.lib.c:52: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. e = getenv ("DH_EXEC_SCRIPTDIR"); data/dh-exec-0.23.2/src/dh-exec.lib.c:63: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. e = getenv ("DH_EXEC_LIBDIR"); data/dh-exec-0.23.2/src/dh-exec.lib.c:74:10: [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. return getenv ("DH_EXEC_SOURCE"); data/dh-exec-0.23.2/src/dh-exec.lib.c:100: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. e = getenv ("DH_EXEC_SCRIPTS"); data/dh-exec-0.23.2/src/dh-exec-install.c:36:3: [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 (glob, "*[./]", 5); data/dh-exec-0.23.2/src/dh-exec-install.c:37:3: [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 (glob + 5, ext, strlen (ext) + 1); data/dh-exec-0.23.2/src/dh-exec.c:332:11: [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 (env + pos, dhe_scripts[i], strlen (dhe_scripts[i])); data/dh-exec-0.23.2/src/dh-exec-install.c:35:18: [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). glob = malloc (strlen (ext) + 6); data/dh-exec-0.23.2/src/dh-exec-install.c:37:26: [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). memcpy (glob + 5, ext, strlen (ext) + 1); data/dh-exec-0.23.2/src/dh-exec.c:153: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). strlen (DH_EXEC_CMD_PREFIX)) != 0 || data/dh-exec-0.23.2/src/dh-exec.c:154:32: [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). strncmp (entry->d_name + strlen (DH_EXEC_CMD_PREFIX), "strip", data/dh-exec-0.23.2/src/dh-exec.c:155: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). strlen ("strip")) == 0) data/dh-exec-0.23.2/src/dh-exec.c:165:15: [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). int cplen = strlen (DH_EXEC_CMD_PREFIX); data/dh-exec-0.23.2/src/dh-exec.c:198:24: [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). strlen (cmdlist[n]->d_name)) != 0) data/dh-exec-0.23.2/src/dh-exec.c:306:19: [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). size += strlen (dhe_scripts[i]) + 1; data/dh-exec-0.23.2/src/dh-exec.c:332:46: [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). memcpy (env + pos, dhe_scripts[i], strlen (dhe_scripts[i])); data/dh-exec-0.23.2/src/dh-exec.c:333:18: [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). pos += strlen (dhe_scripts[i]); data/dh-exec-0.23.2/src/dh-exec.lib.c:104:38: [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 (asprintf (&needle, "%s|", fn + strlen ("dh-exec-")) <= 0) data/dh-exec-0.23.2/src/dh-exec.lib.c:127: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). strlen (DH_EXEC_CMD_PREFIX)) != 0) ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 737 in approximately 0.06 seconds (11947 lines/second) Physical Source Lines of Code (SLOC) = 521 Hits@level = [0] 12 [1] 12 [2] 3 [3] 5 [4] 2 [5] 0 Hits@level+ = [0+] 34 [1+] 22 [2+] 10 [3+] 7 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 65.2591 [1+] 42.2265 [2+] 19.1939 [3+] 13.4357 [4+] 3.83877 [5+] 0 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.