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/reprozip-1.0.16/native/ptrace_utils.c Examining data/reprozip-1.0.16/native/log.h Examining data/reprozip-1.0.16/native/utils.c Examining data/reprozip-1.0.16/native/utils.h Examining data/reprozip-1.0.16/native/pytracer.c Examining data/reprozip-1.0.16/native/database.c Examining data/reprozip-1.0.16/native/pylog.c Examining data/reprozip-1.0.16/native/config.h Examining data/reprozip-1.0.16/native/syscalls.h Examining data/reprozip-1.0.16/native/syscalls.c Examining data/reprozip-1.0.16/native/ptrace_utils.h Examining data/reprozip-1.0.16/native/database.h Examining data/reprozip-1.0.16/native/tracer.h Examining data/reprozip-1.0.16/native/tracer.c FINAL RESULTS: data/reprozip-1.0.16/native/pylog.c:89:22: [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. length = (size_t)vsnprintf(buffer, bufsize, format, args); data/reprozip-1.0.16/native/pylog.c:98:18: [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. length = vsnprintf(buffer, bufsize, format, args); data/reprozip-1.0.16/native/syscalls.c:138:12: [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(pathname, F_OK) != 0 && errno == ENOENT) data/reprozip-1.0.16/native/syscalls.c:520:27: [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). exec_target = strcpy(target_buffer, start); data/reprozip-1.0.16/native/tracer.c:237:15: [4] (format) snprintf: 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. int len = snprintf(&dummy, 1, fmt, tid); data/reprozip-1.0.16/native/tracer.c:239:5: [4] (format) snprintf: 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. snprintf(procfile, len + 1, fmt, tid); data/reprozip-1.0.16/native/tracer.c:684:9: [4] (shell) execvp: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execvp(binary, args); data/reprozip-1.0.16/native/utils.c:64: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(result + len_wd, path); data/reprozip-1.0.16/native/utils.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(result + len_wd + 1, path); data/reprozip-1.0.16/native/pylog.c:71: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 datestr[13]; /* HH:MM:SS.mmm */ data/reprozip-1.0.16/native/pylog.c:86:9: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(datestr+8, ".%03u", (unsigned int)(tv.tv_usec / 1000)); data/reprozip-1.0.16/native/syscalls.c:73:12: [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 buffer[512]; data/reprozip-1.0.16/native/syscalls.c:86: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 buf[50]; data/reprozip-1.0.16/native/syscalls.c:180: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 mode_buf[42] = ""; data/reprozip-1.0.16/native/syscalls.c:183:13: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(mode_buf, "|FILE_READ"); data/reprozip-1.0.16/native/syscalls.c:185:13: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(mode_buf, "|FILE_WRITE"); data/reprozip-1.0.16/native/syscalls.c:187:13: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(mode_buf, "|FILE_WDIR"); data/reprozip-1.0.16/native/syscalls.c:189:13: [2] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant string. strcat(mode_buf, "|FILE_STAT"); data/reprozip-1.0.16/native/syscalls.c:389: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 buffer[SHEBANG_MAX_LEN]; data/reprozip-1.0.16/native/syscalls.c:390: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 target_buffer[SHEBANG_MAX_LEN]; data/reprozip-1.0.16/native/syscalls.c:394:23: [2] (misc) fopen: 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). FILE *execd = fopen(exec_target, "rb"); data/reprozip-1.0.16/native/tracer.c:234: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 previous_path[4096] = ""; data/reprozip-1.0.16/native/tracer.c:252:10: [2] (misc) fopen: 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). fp = fopen(procfile, "r"); data/reprozip-1.0.16/native/tracer.c:258: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 perms[5]; data/reprozip-1.0.16/native/tracer.c:668:9: [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(args, argv, argc * sizeof(char*)); data/reprozip-1.0.16/native/utils.c:63:9: [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(result, wd, len_wd); data/reprozip-1.0.16/native/utils.c:71:9: [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(result, wd, len_wd); data/reprozip-1.0.16/native/database.c:308:20: [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). len += strlen(*a) + 1; data/reprozip-1.0.16/native/tracer.c:263:19: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. int ret = sscanf(line, data/reprozip-1.0.16/native/tracer.c:310:17: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(previous_path, pathname, 4096); data/reprozip-1.0.16/native/utils.c:57: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). size_t len_wd = strlen(wd); data/reprozip-1.0.16/native/utils.c:62:40: [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). char *result = malloc(len_wd + strlen(path) + 1); data/reprozip-1.0.16/native/utils.c:70:44: [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). char *result = malloc(len_wd + 1 + strlen(path) + 1); data/reprozip-1.0.16/native/utils.c:116:21: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int t = getc(fp); ANALYSIS SUMMARY: Hits = 34 Lines analyzed = 3234 in approximately 0.12 seconds (27660 lines/second) Physical Source Lines of Code (SLOC) = 2632 Hits@level = [0] 4 [1] 7 [2] 18 [3] 0 [4] 9 [5] 0 Hits@level+ = [0+] 38 [1+] 34 [2+] 27 [3+] 9 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 14.4377 [1+] 12.9179 [2+] 10.2584 [3+] 3.41945 [4+] 3.41945 [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.