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/libx86-1.1+ds1/thunk.c Examining data/libx86-1.1+ds1/x86-common.c Examining data/libx86-1.1+ds1/x86-common.h Examining data/libx86-1.1+ds1/lrmi.h Examining data/libx86-1.1+ds1/x86emu/debug.c Examining data/libx86-1.1+ds1/x86emu/fpu.c Examining data/libx86-1.1+ds1/x86emu/ops.c Examining data/libx86-1.1+ds1/x86emu/sys.c Examining data/libx86-1.1+ds1/x86emu/validate.c Examining data/libx86-1.1+ds1/x86emu/prim_ops.c Examining data/libx86-1.1+ds1/x86emu/decode.c Examining data/libx86-1.1+ds1/x86emu/ops2.c Examining data/libx86-1.1+ds1/x86emu/x86emu/debug.h Examining data/libx86-1.1+ds1/x86emu/x86emu/fpu.h Examining data/libx86-1.1+ds1/x86emu/x86emu/ops.h Examining data/libx86-1.1+ds1/x86emu/x86emu/fpu_regs.h Examining data/libx86-1.1+ds1/x86emu/x86emu/prim_x86_gcc.h Examining data/libx86-1.1+ds1/x86emu/x86emu/x86emu.h Examining data/libx86-1.1+ds1/x86emu/x86emu/prim_asm.h Examining data/libx86-1.1+ds1/x86emu/x86emu/prim_ops.h Examining data/libx86-1.1+ds1/x86emu/x86emu/decode.h Examining data/libx86-1.1+ds1/x86emu/x86emu/regs.h Examining data/libx86-1.1+ds1/x86emu/x86emu/types.h Examining data/libx86-1.1+ds1/x86emu/x86emu/x86emui.h Examining data/libx86-1.1+ds1/x86emu/include/fpu_regs.h Examining data/libx86-1.1+ds1/x86emu/include/x86emu.h Examining data/libx86-1.1+ds1/x86emu/include/xf86x86emu.h Examining data/libx86-1.1+ds1/x86emu/include/regs.h Examining data/libx86-1.1+ds1/x86emu/include/types.h Examining data/libx86-1.1+ds1/x86emu/include/xf86int10.h Examining data/libx86-1.1+ds1/lrmi.c FINAL RESULTS: data/libx86-1.1+ds1/thunk.c:60:2: [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. fprintf(stderr, fmt, argptr); data/libx86-1.1+ds1/x86emu/debug.c:172:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",x); data/libx86-1.1+ds1/x86emu/debug.c:179:2: [4] (format) sprintf: Potential format string problem (CWE-134). Make format string constant. sprintf(temp,x,y); data/libx86-1.1+ds1/x86emu/debug.c:180:2: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(M.x86.decoded_buf+M.x86.enc_str_pos,"%s",temp); data/libx86-1.1+ds1/x86emu/validate.c:598: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, fmt, argptr); data/libx86-1.1+ds1/x86emu/validate.c:609:9: [4] (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). strcat(buf,separator); data/libx86-1.1+ds1/x86emu/validate.c:614:9: [4] (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). strcat(buf,separator); data/libx86-1.1+ds1/x86emu/validate.c:619:9: [4] (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). strcat(buf,separator); data/libx86-1.1+ds1/x86emu/validate.c:624:9: [4] (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). strcat(buf,separator); data/libx86-1.1+ds1/x86emu/validate.c:629:9: [4] (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). strcat(buf,separator); data/libx86-1.1+ds1/x86emu/validate.c:634:9: [4] (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). strcat(buf,separator); data/libx86-1.1+ds1/x86emu/x86emu/prim_x86_gcc.h:46:66: [4] (shell) system: 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. #error This file is intended to be used by gcc on i386 or x86-64 system data/libx86-1.1+ds1/lrmi.c:170: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. ((unsigned char *)m)[0] = 0xcd; /* int opcode */ data/libx86-1.1+ds1/lrmi.c:171: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. ((unsigned char *)m)[1] = RETURN_TO_32_INT; data/libx86-1.1+ds1/lrmi.c:647:2: [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(&CONTEXT_REGS, sc, sizeof(*sc)); data/libx86-1.1+ds1/lrmi.c:686:2: [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(sc, &CONTEXT_REGS, sizeof(*sc)); data/libx86-1.1+ds1/lrmi.c:695:2: [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(&CONTEXT_REGS, sc, sizeof(*sc)); data/libx86-1.1+ds1/lrmi.c:728:2: [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(sc, &CONTEXT_REGS, sizeof(*sc)); data/libx86-1.1+ds1/x86-common.c:60:12: [2] (misc) open: 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). fd_zero = open("/dev/zero", O_RDWR); data/libx86-1.1+ds1/x86-common.c:215:11: [2] (misc) open: 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). fd_mem = open("/dev/mem", O_RDWR); data/libx86-1.1+ds1/x86emu/debug.c:178:2: [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 temp[100]; data/libx86-1.1+ds1/x86emu/debug.c:193: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 buf1[64]; data/libx86-1.1+ds1/x86emu/debug.c:195:3: [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(buf1+2*i,"%02x", fetch_data_byte_abs(s,o+i)); data/libx86-1.1+ds1/x86emu/debug.c:237: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 s[1024]; data/libx86-1.1+ds1/x86emu/include/regs.h:282: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 decode_buf[32]; /* encoded byte stream */ data/libx86-1.1+ds1/x86emu/include/regs.h:283: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 decoded_buf[256]; /* disassembled strings */ data/libx86-1.1+ds1/x86emu/sys.c:223:12: [2] (misc) open: 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). int fd = open ("/dev/mem", O_RDWR); data/libx86-1.1+ds1/x86emu/sys.c:226: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 (&value, identity+offset, size); data/libx86-1.1+ds1/x86emu/validate.c:64: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:195: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:263: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:343: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:384: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:426: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:467: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:511: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:556: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 buf1[80],buf2[80]; \ data/libx86-1.1+ds1/x86emu/validate.c:610:9: [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(buf,"CF"); data/libx86-1.1+ds1/x86emu/validate.c:615:9: [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(buf,"PF"); data/libx86-1.1+ds1/x86emu/validate.c:620:9: [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(buf,"AF"); data/libx86-1.1+ds1/x86emu/validate.c:625:9: [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(buf,"ZF"); data/libx86-1.1+ds1/x86emu/validate.c:630:9: [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(buf,"SF"); data/libx86-1.1+ds1/x86emu/validate.c:635:9: [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(buf,"OF"); data/libx86-1.1+ds1/x86emu/validate.c:639:9: [2] (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). Risk is low because the source is a constant string. strcpy(buf,"None"); data/libx86-1.1+ds1/x86emu/x86emu/regs.h:281: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 decode_buf[32]; /* encoded byte stream */ data/libx86-1.1+ds1/x86emu/x86emu/regs.h:282: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 decoded_buf[256]; /* disassembled strings */ data/libx86-1.1+ds1/x86emu/debug.c:173:23: [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). M.x86.enc_str_pos += strlen(x); data/libx86-1.1+ds1/x86emu/debug.c:181:23: [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). M.x86.enc_str_pos += strlen(temp); ANALYSIS SUMMARY: Hits = 48 Lines analyzed = 26429 in approximately 0.70 seconds (37952 lines/second) Physical Source Lines of Code (SLOC) = 20186 Hits@level = [0] 101 [1] 2 [2] 34 [3] 0 [4] 12 [5] 0 Hits@level+ = [0+] 149 [1+] 48 [2+] 46 [3+] 12 [4+] 12 [5+] 0 Hits/KSLOC@level+ = [0+] 7.38135 [1+] 2.37789 [2+] 2.27881 [3+] 0.594471 [4+] 0.594471 [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.