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/mutextrace-0.1.4/mutextrace.c Examining data/mutextrace-0.1.4/tests/mutex_timeout.c Examining data/mutextrace-0.1.4/tests/common.c Examining data/mutextrace-0.1.4/tests/mutex_working.c Examining data/mutextrace-0.1.4/tests/common.h Examining data/mutextrace-0.1.4/tests/two_threads_one_mutex.c Examining data/mutextrace-0.1.4/real.h Examining data/mutextrace-0.1.4/store.h Examining data/mutextrace-0.1.4/mutex_init.c Examining data/mutextrace-0.1.4/real.c Examining data/mutextrace-0.1.4/mutex_lock.c Examining data/mutextrace-0.1.4/mutex_unlock.c Examining data/mutextrace-0.1.4/thread_create.c Examining data/mutextrace-0.1.4/store.c Examining data/mutextrace-0.1.4/mutex_destroy.c FINAL RESULTS: data/mutextrace-0.1.4/mutextrace.c:64:13: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(oo, PRELOADLIB); data/mutextrace-0.1.4/mutextrace.c:73:9: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(new_preload, "LD_PRELOAD=" PRELOADLIB); data/mutextrace-0.1.4/mutextrace.c:128:13: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(oo, argv[1]); data/mutextrace-0.1.4/mutextrace.c:129:17: [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(pathbuf, X_OK)) data/mutextrace-0.1.4/tests/common.c:22:31: [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 const *preload = getenv("LD_PRELOAD"); data/mutextrace-0.1.4/mutextrace.c:20: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 *new_argv[max_args]; data/mutextrace-0.1.4/mutextrace.c:21: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 *new_envp[max_envs]; data/mutextrace-0.1.4/mutextrace.c:22: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 new_preload[max_preload]; data/mutextrace-0.1.4/tests/common.c:51:34: [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 *)wrapper, data/mutextrace-0.1.4/tests/common.c:68:25: [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[64]; data/mutextrace-0.1.4/mutextrace.c:89:25: [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_t cmdlen = strlen(argv[1]) + 2; // plus slash and NUL data/mutextrace-0.1.4/tests/common.c:86:49: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ssize_t count = read(fds[0], buffer, sizeof buffer); data/mutextrace-0.1.4/tests/two_threads_one_mutex.c:37:5: [1] (obsolete) usleep: This C routine is considered obsolete (as opposed to the shell command by the same name). The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), and nanosleep() is unspecified (CWE-676). Use nanosleep(2) or setitimer(2) instead. usleep(500); ANALYSIS SUMMARY: Hits = 13 Lines analyzed = 924 in approximately 0.04 seconds (26239 lines/second) Physical Source Lines of Code (SLOC) = 708 Hits@level = [0] 14 [1] 3 [2] 5 [3] 1 [4] 4 [5] 0 Hits@level+ = [0+] 27 [1+] 13 [2+] 10 [3+] 5 [4+] 4 [5+] 0 Hits/KSLOC@level+ = [0+] 38.1356 [1+] 18.3616 [2+] 14.1243 [3+] 7.06215 [4+] 5.64972 [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.