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/pg-bsd-indent-2.1.1/args.c Examining data/pg-bsd-indent-2.1.1/err.c Examining data/pg-bsd-indent-2.1.1/err.h Examining data/pg-bsd-indent-2.1.1/indent.h Examining data/pg-bsd-indent-2.1.1/indent_codes.h Examining data/pg-bsd-indent-2.1.1/io.c Examining data/pg-bsd-indent-2.1.1/lexi.c Examining data/pg-bsd-indent-2.1.1/parse.c Examining data/pg-bsd-indent-2.1.1/pr_comment.c Examining data/pg-bsd-indent-2.1.1/indent.c Examining data/pg-bsd-indent-2.1.1/indent_globs.h FINAL RESULTS: data/pg-bsd-indent-2.1.1/err.c:49: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, ap); data/pg-bsd-indent-2.1.1/err.c:63: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, ap); data/pg-bsd-indent-2.1.1/indent.c:1220:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(bakfile, "%s.BAK", p); data/pg-bsd-indent-2.1.1/io.c:130:7: [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(output, s[0]=='/' && s[1]=='*' ? "\t%.*s" : "\t/* %.*s */", data/pg-bsd-indent-2.1.1/io.c:565: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(stdout, msg, a, b); data/pg-bsd-indent-2.1.1/io.c:570: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, msg, a, b); data/pg-bsd-indent-2.1.1/io.c:582: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(stdout, msg, a); data/pg-bsd-indent-2.1.1/io.c:587: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, msg, a); data/pg-bsd-indent-2.1.1/args.c:187:42: [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. snprintf(fname, sizeof(fname), "%s/%s", getenv("HOME"), prof); data/pg-bsd-indent-2.1.1/args.c:183: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 fname[PATH_MAX]; data/pg-bsd-indent-2.1.1/args.c:190: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). if ((f = fopen(option_source = fname, "r")) != NULL) { data/pg-bsd-indent-2.1.1/args.c:194: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). if ((f = fopen(option_source = prof, "r")) != NULL) { data/pg-bsd-indent-2.1.1/args.c:206: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[BUFSIZ]; data/pg-bsd-indent-2.1.1/args.c:330:14: [2] (integer) atoi: Unless checked, the resulting number can exceed the expected range (CWE-190). If source untrusted, check both minimum and maximum, even if the input had no minus sign (large numbers can roll over into negative number; consider saving to an unsigned value if that is intended). *p->p_obj = atoi(param_start); data/pg-bsd-indent-2.1.1/args.c:342: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 line[BUFSIZ]; data/pg-bsd-indent-2.1.1/args.c:344: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). if ((file = fopen(str, "r")) == NULL) { data/pg-bsd-indent-2.1.1/indent.c:67: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 bakfile[MAXPATHLEN] = ""; data/pg-bsd-indent-2.1.1/indent.c:203:11: [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 = fopen(in_name, "r"); data/pg-bsd-indent-2.1.1/indent.c:214:12: [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 = fopen(out_name, "w"); data/pg-bsd-indent-2.1.1/indent.c:312:7: [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_buf, in_buffer, buf_ptr - in_buffer - 4); data/pg-bsd-indent-2.1.1/indent.c:501: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(e_code, s_com, len); data/pg-bsd-indent-2.1.1/indent.c:642: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(e_code, token, len); data/pg-bsd-indent-2.1.1/indent.c:655: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(e_code, token, len); data/pg-bsd-indent-2.1.1/indent.c:704: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(e_lab, s_code, len); data/pg-bsd-indent-2.1.1/indent.c:997: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(e_code, s_token, len); data/pg-bsd-indent-2.1.1/indent.c:1011: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(e_code, token, len); data/pg-bsd-indent-2.1.1/indent.c:1211: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 buff[8 * 1024]; data/pg-bsd-indent-2.1.1/indent.c:1235:13: [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 = fopen(bakfile, "r"); data/pg-bsd-indent-2.1.1/indent.c:1239: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). output = fopen(in_name, "w"); data/pg-bsd-indent-2.1.1/indent_globs.h:143: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. extern char sc_buf[sc_size]; /* input text is saved here when looking for data/pg-bsd-indent-2.1.1/indent_globs.h:332: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 procname[100]; /* The name of the current procedure */ data/pg-bsd-indent-2.1.1/lexi.c:123: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 chartype[128] = data/pg-bsd-indent-2.1.1/lexi.c:269:7: [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(e_token, buf_ptr, len); data/pg-bsd-indent-2.1.1/lexi.c:684:24: [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. typenames = (const char **)malloc(sizeof(typenames[0]) * data/pg-bsd-indent-2.1.1/args.c:211:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((i = getc(f)) != EOF) { data/pg-bsd-indent-2.1.1/indent.c:1226:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((n = read(fileno(input), buff, sizeof(buff))) > 0) data/pg-bsd-indent-2.1.1/io.c:285:14: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int i = getc(input); data/pg-bsd-indent-2.1.1/io.c:378:15: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((i = getc(f)) == EOF) { data/pg-bsd-indent-2.1.1/lexi.c:420:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(state->procname, token, sizeof state->procname - 1); ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 4246 in approximately 0.14 seconds (30505 lines/second) Physical Source Lines of Code (SLOC) = 2875 Hits@level = [0] 32 [1] 5 [2] 25 [3] 1 [4] 8 [5] 0 Hits@level+ = [0+] 71 [1+] 39 [2+] 34 [3+] 9 [4+] 8 [5+] 0 Hits/KSLOC@level+ = [0+] 24.6957 [1+] 13.5652 [2+] 11.8261 [3+] 3.13043 [4+] 2.78261 [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.