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/mupen64plus-rsp-z64-2.5.9/src/main_rsp.cpp Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp.h Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.h Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp_opinfo.cpp Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp_opinfo.h Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp_recomp.cpp Examining data/mupen64plus-rsp-z64-2.5.9/src/rsp_recomp.h Examining data/mupen64plus-rsp-z64-2.5.9/src/z64.h FINAL RESULTS: data/mupen64plus-rsp-z64-2.5.9/src/main_rsp.cpp:85: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(buf, 1023, msg, args); data/mupen64plus-rsp-z64-2.5.9/src/main_rsp.cpp:253:17: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. printf("%10g %10g %7d\t%30s\n" data/mupen64plus-rsp-z64-2.5.9/src/rsp.h:420:5: [4] (format) vfprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vfprintf(stderr, s, ap); data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:108:19: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. output += vsprintf(output, fmt, vl); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:165:19: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. has_cond = 1, fprintf data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:177:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmps, "%s { /*if (rsp.inval_gen) { rsp.nextpc=0x%x; return 0; }*/ %s goto L%d; }", has_cond? "if (cond)":"", a, has_cond? "cond=0; ":"", OPI(a).label); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:188:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmps, "%s { return 0; }", has_cond? "if (cond)":""); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:194:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(tmps, data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:265:5: [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(gen->name, lib); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:644:9: [4] (shell) execl: 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. execl("/usr/bin/gcc", "/usr/bin/gcc", "-Iz64", "-shared", "-O6", src, "-o", lib, "-fomit-frame-pointer", "-ffast-math", "-funroll-loops", "-fforce-addr", "-finline-limit=10000", "-m3dnow", "-mmmx", "-msse", "-msse2", 0); data/mupen64plus-rsp-z64-2.5.9/src/main_rsp.cpp:52:17: [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 * fp = fopen("rsp.dump", "w"); data/mupen64plus-rsp-z64-2.5.9/src/main_rsp.cpp:82: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 buf[1024]; data/mupen64plus-rsp-z64-2.5.9/src/main_rsp.cpp:249:13: [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 s[128], s2[128]; data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp:230: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 string[200]; data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp:237: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 string[200]; data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp:240:16: [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). dasm = fopen("rsp_disasm.txt", "wt"); data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp:255:16: [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). dmem = fopen("rsp_dmem.bin", "wb"); data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp:313:19: [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). exec_output = fopen("rsp_execute.txt", "wt"); data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp:2532: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 s[128]; data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp:2747:13: [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 string[200]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:43:14: [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 const char *reg[32] = data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:51:14: [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 const char *vreg[32] = data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:59:14: [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 const char *cop0_regs[32] = data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:71:14: [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 const char *element[16] = data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:77:14: [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 const char *element2[16] = data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:86: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 temp[10]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:91:17: [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(temp, "-$%04x", -value); data/mupen64plus-rsp-z64-2.5.9/src/rsp_dasm.cpp:95:17: [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(temp, "$%04x", value); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:39: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 name[32]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:160:8: [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 tmps[1024]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:239: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 src[128]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:240: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 lib[128]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:241: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 sym[128]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:242:5: [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(lib, "z64/rspgen/%x-%x-%x.so", crc, pc, len); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:243:5: [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(sym, "doit%x", crc); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:279:5: [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(src, "z64/rspgen/%x-%x-%x.cpp", crc, pc, len); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:280:17: [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 * fp = fopen(src, "w"); data/mupen64plus-rsp-z64-2.5.9/src/rsp_gen.cpp:296:13: [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 s[128]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_recomp.cpp:38: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 name[32]; data/mupen64plus-rsp-z64-2.5.9/src/rsp_recomp.cpp:325:5: [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(gen->bc, bc, sizeof(rsp_bc_t)*lbc); data/mupen64plus-rsp-z64-2.5.9/src/rsp.cpp:2752: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). l = strlen(string); ANALYSIS SUMMARY: Hits = 41 Lines analyzed = 6697 in approximately 0.16 seconds (42043 lines/second) Physical Source Lines of Code (SLOC) = 4943 Hits@level = [0] 29 [1] 1 [2] 30 [3] 0 [4] 10 [5] 0 Hits@level+ = [0+] 70 [1+] 41 [2+] 40 [3+] 10 [4+] 10 [5+] 0 Hits/KSLOC@level+ = [0+] 14.1614 [1+] 8.29456 [2+] 8.09225 [3+] 2.02306 [4+] 2.02306 [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.