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/z80dasm-1.1.6/src/symtab.h Examining data/z80dasm-1.1.6/src/symload.c Examining data/z80dasm-1.1.6/src/utils.c Examining data/z80dasm-1.1.6/src/utils.h Examining data/z80dasm-1.1.6/src/dz80.h Examining data/z80dasm-1.1.6/src/blocks.h Examining data/z80dasm-1.1.6/src/symtab.c Examining data/z80dasm-1.1.6/src/dz80dat.c Examining data/z80dasm-1.1.6/src/table.c Examining data/z80dasm-1.1.6/src/cmdline.c Examining data/z80dasm-1.1.6/src/blocks.c Examining data/z80dasm-1.1.6/src/dz80.c FINAL RESULTS: data/z80dasm-1.1.6/src/cmdline.c:52: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. r=vfprintf(stderr, format, ap); data/z80dasm-1.1.6/src/dz80.c:32:12: [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. #define FP fprintf data/z80dasm-1.1.6/src/dz80.c:114:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"%s", symb->name); data/z80dasm-1.1.6/src/dz80.c:122:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str,"%s+%d", symb->name, off); data/z80dasm-1.1.6/src/dz80.c:155:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(str, "%s", symb->name); data/z80dasm-1.1.6/src/dz80.c:259:11: [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). case 0: strcpy(rstr,ed40[a-0x40]); data/z80dasm-1.1.6/src/dz80.c:261:11: [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). case 1: strcpy(rstr,ed50[a-0x50]); data/z80dasm-1.1.6/src/dz80.c:263:11: [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). case 2: strcpy(rstr,ed60[a-0x60]); data/z80dasm-1.1.6/src/dz80.c:268:4: [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(rstr,ed70[a-0x70]); data/z80dasm-1.1.6/src/dz80.c:270:11: [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). case 4: strcpy(rstr,eda0[a-0xa0]); data/z80dasm-1.1.6/src/dz80.c:272:11: [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). case 5: strcpy(rstr,edb0[a-0xb0]); data/z80dasm-1.1.6/src/dz80.c:437:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(stro,"(%s+0%02xh)",stri,t[2]); data/z80dasm-1.1.6/src/dz80.c:440:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(stro,"(%s-0%02xh)",stri,256 - t[2]); data/z80dasm-1.1.6/src/cmdline.c:132:11: [3] (buffer) getopt_long: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while((c=getopt_long(argc, argv, opts, longopts, NULL))!=-1) { data/z80dasm-1.1.6/src/blocks.c:73: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(dest, src, sizeof(*dest)); data/z80dasm-1.1.6/src/blocks.c:189: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 tmp[MAX_LINE_LEN]; data/z80dasm-1.1.6/src/blocks.c:234: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 line[MAX_LINE_LEN]; data/z80dasm-1.1.6/src/blocks.c:245:4: [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). f=fopen(filename, "r"); data/z80dasm-1.1.6/src/dz80.c:97: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(str,"0%04xh",val); data/z80dasm-1.1.6/src/dz80.c:127:2: [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(str, "0%04xh", val); data/z80dasm-1.1.6/src/dz80.c:161: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(str,"%d",t[1]+2); data/z80dasm-1.1.6/src/dz80.c:163: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(str,"%d",t[1]+2-256); data/z80dasm-1.1.6/src/dz80.c:169: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(str,"$%+d",t[1]+2); data/z80dasm-1.1.6/src/dz80.c:171: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(str,"$%+d",t[1]+2-256); data/z80dasm-1.1.6/src/dz80.c:202:1: [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 stro[80]; data/z80dasm-1.1.6/src/dz80.c:204:1: [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 bstr[MAX_LINE_LEN]; data/z80dasm-1.1.6/src/dz80.c:205:1: [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 rstr[MAX_LINE_LEN]; data/z80dasm-1.1.6/src/dz80.c:279:3: [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(stro,"%s),bc"); data/z80dasm-1.1.6/src/dz80.c:283:3: [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(stro,"%s),de"); data/z80dasm-1.1.6/src/dz80.c:287:3: [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(stro,"%s),sp"); data/z80dasm-1.1.6/src/dz80.c:291:3: [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(stro,"%s)"); data/z80dasm-1.1.6/src/dz80.c:739: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 bstr[MAX_LINE_LEN]; data/z80dasm-1.1.6/src/dz80.c:829:6: [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). f1=fopen(a_input, "rb"); data/z80dasm-1.1.6/src/dz80.c:848:6: [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). f2=fopen(a_symoutput, "w"); data/z80dasm-1.1.6/src/dz80.c:859:6: [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). f3=fopen(a_output, "w"); data/z80dasm-1.1.6/src/dz80.c:896:8: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). pass1=tmpfile(); data/z80dasm-1.1.6/src/dz80.c:902:8: [2] (tmpfile) tmpfile: Function tmpfile() has a security flaw on some systems (e.g., older System V systems) (CWE-377). pass2=tmpfile(); data/z80dasm-1.1.6/src/symload.c:25:1: [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 *include[MAX_INCLUDE_TOP]; data/z80dasm-1.1.6/src/symload.c:51: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 line[MAX_LINE_LEN]; data/z80dasm-1.1.6/src/symload.c:70:4: [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). f=fopen(filename, "r"); data/z80dasm-1.1.6/src/symload.c:141: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 *tokens[MAX_TOKENS]; data/z80dasm-1.1.6/src/symtab.c:224: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 name[10]; data/z80dasm-1.1.6/src/symtab.c:230:4: [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(name, "sub_%04xh", val); data/z80dasm-1.1.6/src/symtab.c:232:4: [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(name, "l%04xh", val); data/z80dasm-1.1.6/src/blocks.c:314:9: [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(tok[strlen(tok)-1]!=':') { data/z80dasm-1.1.6/src/blocks.c:320:6: [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). tok[strlen(tok)-1]=0; data/z80dasm-1.1.6/src/dz80.c:66:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). t[T_SIZE-1]=getc(f1); data/z80dasm-1.1.6/src/symload.c:105:5: [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(strlen(param)<3) { data/z80dasm-1.1.6/src/symload.c:109:28: [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(param[0]!='"' || param[strlen(param)-1]!='"') { data/z80dasm-1.1.6/src/symload.c:119:8: [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). param[strlen(param)-1]=0; data/z80dasm-1.1.6/src/symload.c:178:11: [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(named[strlen(named)-1]!=':') { data/z80dasm-1.1.6/src/symload.c:184:8: [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). named[strlen(named)-1]=0; ANALYSIS SUMMARY: Hits = 52 Lines analyzed = 3385 in approximately 0.12 seconds (29251 lines/second) Physical Source Lines of Code (SLOC) = 2624 Hits@level = [0] 58 [1] 8 [2] 30 [3] 1 [4] 13 [5] 0 Hits@level+ = [0+] 110 [1+] 52 [2+] 44 [3+] 14 [4+] 13 [5+] 0 Hits/KSLOC@level+ = [0+] 41.9207 [1+] 19.8171 [2+] 16.7683 [3+] 5.33537 [4+] 4.95427 [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.