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/btyacc-3.0+dfsg/error.c Examining data/btyacc-3.0+dfsg/symtab.c Examining data/btyacc-3.0+dfsg/lalr.c Examining data/btyacc-3.0+dfsg/verbose.c Examining data/btyacc-3.0+dfsg/lr0.c Examining data/btyacc-3.0+dfsg/warshall.c Examining data/btyacc-3.0+dfsg/closure.c Examining data/btyacc-3.0+dfsg/skeleton.c Examining data/btyacc-3.0+dfsg/readskel.c Examining data/btyacc-3.0+dfsg/mstring.h Examining data/btyacc-3.0+dfsg/defs.h Examining data/btyacc-3.0+dfsg/main.c Examining data/btyacc-3.0+dfsg/mkpar.c Examining data/btyacc-3.0+dfsg/mstring.c Examining data/btyacc-3.0+dfsg/output.c Examining data/btyacc-3.0+dfsg/reader.c FINAL RESULTS: data/btyacc-3.0+dfsg/error.c:21:3: [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, args); data/btyacc-3.0+dfsg/error.c:86:3: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(sbuf, msg, args); data/btyacc-3.0+dfsg/main.c:163:8: [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(*ps, var_name); data/btyacc-3.0+dfsg/main.c:286: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(action_file_name, tmpdir); data/btyacc-3.0+dfsg/main.c:287: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(text_file_name, tmpdir); data/btyacc-3.0+dfsg/main.c:288: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(union_file_name, tmpdir); data/btyacc-3.0+dfsg/main.c:298: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(action_file_name + len, temp_form); data/btyacc-3.0+dfsg/main.c:299: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(text_file_name + len, temp_form); data/btyacc-3.0+dfsg/main.c:300: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(union_file_name + len, temp_form); data/btyacc-3.0+dfsg/main.c:311: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(output_file_name, file_prefix); data/btyacc-3.0+dfsg/main.c:312: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(output_file_name + len, OUTPUT_SUFFIX); data/btyacc-3.0+dfsg/main.c:319:2: [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(code_file_name, file_prefix); data/btyacc-3.0+dfsg/main.c:320:2: [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(code_file_name + len, CODE_SUFFIX); data/btyacc-3.0+dfsg/main.c:330:2: [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(defines_file_name, file_prefix); data/btyacc-3.0+dfsg/main.c:331:2: [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(defines_file_name + len, DEFINES_SUFFIX); data/btyacc-3.0+dfsg/main.c:339:2: [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(verbose_file_name, file_prefix); data/btyacc-3.0+dfsg/main.c:340:2: [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(verbose_file_name + len, VERBOSE_SUFFIX); data/btyacc-3.0+dfsg/mstring.c:21:5: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf, fmt, args); data/btyacc-3.0+dfsg/output.c:881:3: [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(out, line_format+1, outline + 1, code_file_name); data/btyacc-3.0+dfsg/output.c:892: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(out, line_format, ++outline + 1, code_file_name); data/btyacc-3.0+dfsg/output.c:1144:6: [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(out, line_format, lineno, (inc_file?inc_file_name:input_file_name)); data/btyacc-3.0+dfsg/output.c:1156:6: [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(out, line_format, lineno, (inc_file?inc_file_name:input_file_name)); data/btyacc-3.0+dfsg/output.c:1178: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(out, line_format, ++outline + 1, code_file_name); data/btyacc-3.0+dfsg/output.c:1199:3: [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(out, line_format+1, outline + 1, code_file_name); data/btyacc-3.0+dfsg/output.c:1217: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(out, line_format, ++outline + 1, code_file_name); data/btyacc-3.0+dfsg/reader.c:182: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(*ps, var_name); data/btyacc-3.0+dfsg/reader.c:399:17: [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. if (!lflag) fprintf(f, line_format, lineno, (inc_file?inc_file_name:input_file_name)); data/btyacc-3.0+dfsg/reader.c:445: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(text_file, line_format, lineno, (inc_file?inc_file_name:input_file_name)); data/btyacc-3.0+dfsg/reader.c:1300:6: [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(f, line_format, lineno, (inc_file?inc_file_name:input_file_name)); data/btyacc-3.0+dfsg/reader.c:1396: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(f, line_format, lineno, (inc_file?inc_file_name:input_file_name)); data/btyacc-3.0+dfsg/reader.c:1521:3: [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(f, line_format, lineno, (inc_file?inc_file_name:input_file_name)); data/btyacc-3.0+dfsg/reader.c:1565:3: [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(f, line_format, lineno, (inc_file?inc_file_name:input_file_name)); data/btyacc-3.0+dfsg/readskel.c:47:5: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buf, fmt, args); data/btyacc-3.0+dfsg/symtab.c:52: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(bp->name, name); data/btyacc-3.0+dfsg/main.c:271:14: [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. tmpdir = getenv("TMPDIR"); data/btyacc-3.0+dfsg/error.c:82:3: [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 sbuf[512]; data/btyacc-3.0+dfsg/main.c:353:8: [2] (tmpfile) mkstemp: Potential for temporary file vulnerability in some circumstances. Some older Unix-like systems create temp files with permission to write by all by default, so be sure to set the umask to override this. Also, some older Unix systems might fail to use O_EXCL when opening the file, so make sure that O_EXCL is used by the library (CWE-377). fd = mkstemp(template); data/btyacc-3.0+dfsg/main.c:368:15: [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). input_file = fopen(input_file_name, "r"); data/btyacc-3.0+dfsg/main.c:383: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). verbose_file = fopen(verbose_file_name, "w"); data/btyacc-3.0+dfsg/main.c:390: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). defines_file = fopen(defines_file_name, "w"); data/btyacc-3.0+dfsg/main.c:398: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). output_file = fopen(output_file_name, "w"); data/btyacc-3.0+dfsg/main.c:404:14: [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). code_file = fopen(code_file_name, "w"); data/btyacc-3.0+dfsg/mstring.c:15: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 buf[4096]; /* a big static buffer */ data/btyacc-3.0+dfsg/mstring.c:35: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(s->ptr, buf, len); data/btyacc-3.0+dfsg/reader.c:26: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 inc_file_name[LINESIZE]; data/btyacc-3.0+dfsg/reader.c:33: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 *defd_vars[MAX_DEFD_VARS] = {NULL}; data/btyacc-3.0+dfsg/reader.c:108: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 var_name[80]; data/btyacc-3.0+dfsg/reader.c:157: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). inc_file = fopen(inc_file_name, "r"); data/btyacc-3.0+dfsg/reader.c:168: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 var_name[80]; data/btyacc-3.0+dfsg/reader.c:265:25: [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 struct keyword { char name[12]; int token; } keywords[] = { data/btyacc-3.0+dfsg/reader.c:569:17: [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. c = ((unsigned char *)s)[i]; data/btyacc-3.0+dfsg/reader.c:800: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 *tags[MAXARGS]; data/btyacc-3.0+dfsg/reader.c:1264: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(cache, "$$%d", ++gensym); data/btyacc-3.0+dfsg/reader.c:1675:5: [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(name_pool, "$accept"); data/btyacc-3.0+dfsg/reader.c:1676:5: [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(name_pool+8, "$end"); data/btyacc-3.0+dfsg/readskel.c:20:6: [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(nap, ap_start, (ap-ap_start) * sizeof(char *)); data/btyacc-3.0+dfsg/readskel.c:36: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(cp, s, len); data/btyacc-3.0+dfsg/readskel.c:44: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 buf[256]; data/btyacc-3.0+dfsg/readskel.c:64: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 buf[256]; data/btyacc-3.0+dfsg/readskel.c:70: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). if (!(fp = fopen(name, "r"))) data/btyacc-3.0+dfsg/main.c:162: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). *ps = MALLOC(strlen(var_name)+1); data/btyacc-3.0+dfsg/main.c:274: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). len = strlen(tmpdir); data/btyacc-3.0+dfsg/main.c:306: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). len = strlen(file_prefix); data/btyacc-3.0+dfsg/main.c:352:14: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). old_mode = umask(077); data/btyacc-3.0+dfsg/main.c:354:3: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). umask(old_mode); data/btyacc-3.0+dfsg/mstring.c:24: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). len = strlen(buf); data/btyacc-3.0+dfsg/output.c:853:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(union_file)) != EOF) { data/btyacc-3.0+dfsg/output.c:874:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = getc(in)) == EOF) data/btyacc-3.0+dfsg/output.c:890:19: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). } while ((c = getc(in)) != EOF); data/btyacc-3.0+dfsg/output.c:1028:7: [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(s) + 3; data/btyacc-3.0+dfsg/output.c:1139:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = getc(in)) == EOF) data/btyacc-3.0+dfsg/output.c:1164:17: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = getc(in)) != EOF) data/btyacc-3.0+dfsg/output.c:1190:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = getc(action_file)) == EOF) data/btyacc-3.0+dfsg/output.c:1208:19: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). } while ((c = getc(action_file)) != EOF); data/btyacc-3.0+dfsg/reader.c:75:23: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (saw_eof || (c = getc(f)) == EOF) { data/btyacc-3.0+dfsg/reader.c:99:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = getc(f)) == EOF) { data/btyacc-3.0+dfsg/reader.c:181:18: [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). *ps = MALLOC(strlen(var_name)+1); data/btyacc-3.0+dfsg/reader.c:707:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(s, tag, len); data/btyacc-3.0+dfsg/reader.c:1671: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). name_pool_size += strlen(bp->name) + 1; data/btyacc-3.0+dfsg/reader.c:1867: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). spacing = strlen(symbol_name[rlhs[i]]) + 1; } data/btyacc-3.0+dfsg/readskel.c:29: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). int len = strlen(s)+1; data/btyacc-3.0+dfsg/readskel.c:75: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 ((i = strlen(buf)) == 0) data/btyacc-3.0+dfsg/symtab.c:39: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). bp->name = MALLOC(strlen(name) + 1); ANALYSIS SUMMARY: Hits = 83 Lines analyzed = 7755 in approximately 0.19 seconds (40416 lines/second) Physical Source Lines of Code (SLOC) = 6562 Hits@level = [0] 209 [1] 23 [2] 25 [3] 1 [4] 34 [5] 0 Hits@level+ = [0+] 292 [1+] 83 [2+] 60 [3+] 35 [4+] 34 [5+] 0 Hits/KSLOC@level+ = [0+] 44.4986 [1+] 12.6486 [2+] 9.14355 [3+] 5.33374 [4+] 5.18135 [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.