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/mutrace-0.2.0/matrace.c Examining data/mutrace-0.2.0/mutrace.c Examining data/mutrace-0.2.0/backtrace-symbols.c FINAL RESULTS: data/mutrace-0.2.0/backtrace-symbols.c:360:3: [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(f_strings, locations[x][0]); data/mutrace-0.2.0/matrace.c:306:25: [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(p, strings[i-1]); data/mutrace-0.2.0/matrace.c:314:17: [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(p, strings[i]); data/mutrace-0.2.0/mutrace.c:805:25: [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(p, strings[i-1]); data/mutrace-0.2.0/mutrace.c:813:17: [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(p, strings[i]); data/mutrace-0.2.0/matrace.c:112:19: [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 (!(e = getenv(n))) data/mutrace-0.2.0/mutrace.c:183:19: [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 (!(e = getenv(n))) data/mutrace-0.2.0/mutrace.c:332: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("MUTRACE_TRAP")) data/mutrace-0.2.0/mutrace.c:335: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("MUTRACE_TRACK_RT")) data/mutrace-0.2.0/backtrace-symbols.c:148:45: [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. static void translate_addresses(bfd * abfd, char (*addr)[PTRSTR_LEN], int naddr) data/mutrace-0.2.0/matrace.c:96:16: [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. static char prname[17]; data/mutrace-0.2.0/mutrace.c:167:16: [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. static char prname[17]; data/mutrace-0.2.0/mutrace.c:900: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(mutex, &template, sizeof(pthread_mutex_t)); data/mutrace-0.2.0/mutrace.c:1282: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(rwlock, &template, sizeof(pthread_rwlock_t)); data/mutrace-0.2.0/backtrace-symbols.c:344:21: [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 (match.file && strlen(match.file)) data/mutrace-0.2.0/backtrace-symbols.c:349:12: [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). total += strlen(ret_buf[0]) + 1; data/mutrace-0.2.0/backtrace-symbols.c:363: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). f_strings += strlen(f_strings) + 1; data/mutrace-0.2.0/matrace.c:147:19: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. LOAD_FUNC(memalign); data/mutrace-0.2.0/matrace.c:293:22: [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). k += strlen(strings[i]) + 2; data/mutrace-0.2.0/matrace.c:307:30: [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). p += strlen(strings[i-1]); data/mutrace-0.2.0/matrace.c:315:22: [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). p += strlen(strings[i]); data/mutrace-0.2.0/matrace.c:424:7: [1] (free) memalign: On some systems (though not Linux-based systems) an attempt to free() results from memalign() may fail. This may, on a few systems, be exploitable. Also note that memalign() may not check that the boundary parameter is correct (CWE-676). Use posix_memalign instead (defined in POSIX's 1003.1d). Don't switch to valloc(); it is marked as obsolete in BSD 4.3, as legacy in SUSv2, and is no longer defined in SUSv3. In some cases, malloc()'s alignment may be sufficient. void *memalign(size_t a, size_t s) { data/mutrace-0.2.0/mutrace.c:792:22: [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). k += strlen(strings[i]) + 2; data/mutrace-0.2.0/mutrace.c:806:30: [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). p += strlen(strings[i-1]); data/mutrace-0.2.0/mutrace.c:814:22: [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). p += strlen(strings[i]); ANALYSIS SUMMARY: Hits = 25 Lines analyzed = 2436 in approximately 0.07 seconds (37202 lines/second) Physical Source Lines of Code (SLOC) = 1680 Hits@level = [0] 37 [1] 11 [2] 5 [3] 4 [4] 5 [5] 0 Hits@level+ = [0+] 62 [1+] 25 [2+] 14 [3+] 9 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 36.9048 [1+] 14.881 [2+] 8.33333 [3+] 5.35714 [4+] 2.97619 [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.