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/dfc-3.1.1/src/dfc.c Examining data/dfc-3.1.1/src/dfc.h Examining data/dfc-3.1.1/src/dotfile.c Examining data/dfc-3.1.1/src/dotfile.h Examining data/dfc-3.1.1/src/export/csv.c Examining data/dfc-3.1.1/src/export/display.h Examining data/dfc-3.1.1/src/export/export.h Examining data/dfc-3.1.1/src/export/html.c Examining data/dfc-3.1.1/src/export/json.c Examining data/dfc-3.1.1/src/export/tex.c Examining data/dfc-3.1.1/src/export/text.c Examining data/dfc-3.1.1/src/extern.h Examining data/dfc-3.1.1/src/list.c Examining data/dfc-3.1.1/src/list.h Examining data/dfc-3.1.1/src/platform/services-bsd.c Examining data/dfc-3.1.1/src/platform/services-linux.c Examining data/dfc-3.1.1/src/platform/services-solaris.c Examining data/dfc-3.1.1/src/platform/services.h Examining data/dfc-3.1.1/src/util.c Examining data/dfc-3.1.1/src/util.h FINAL RESULTS: data/dfc-3.1.1/src/dotfile.c:95:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(conf, F_OK) == 0) data/dfc-3.1.1/src/dotfile.c:106:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(conf, F_OK) == 0) data/dfc-3.1.1/src/dotfile.c:114:7: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(conf, F_OK) == 0) data/dfc-3.1.1/src/export/csv.c:193:9: [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. (void)printf(i == 0 ? "%.f" : "%.1f", n); data/dfc-3.1.1/src/export/csv.c:238:9: [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. (void)printf("%c%" PRIu64, cnf.csvsep, files); data/dfc-3.1.1/src/export/csv.c:241:9: [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. (void)printf("%c%" PRIu64, cnf.csvsep, favail); data/dfc-3.1.1/src/export/csv.c:244:9: [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. (void)printf("%c%" PRIu64, cnf.csvsep, files); data/dfc-3.1.1/src/export/csv.c:245:9: [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. (void)printf("%c%" PRIu64, cnf.csvsep, favail); data/dfc-3.1.1/src/export/html.c:298:9: [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. (void)printf(i == 0 ? "%.f" : "%.1f", n); data/dfc-3.1.1/src/export/html.c:347:9: [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. (void)printf("\t <td style = \"text-align: right;\">%" PRIu64, data/dfc-3.1.1/src/export/html.c:352:9: [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. (void)printf("\t <td style = \"text-align: right;\">%" PRIu64, data/dfc-3.1.1/src/export/json.c:164:8: [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. (void)printf(i == 0 ? "%.f" : "%.1f", n); data/dfc-3.1.1/src/export/json.c:220:9: [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. (void)printf(",\"inodes_count\":\"%" PRIu64, files); data/dfc-3.1.1/src/export/json.c:224:9: [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. (void)printf(",\"inodes_available\":\"%" PRIu64, favail); data/dfc-3.1.1/src/export/tex.c:281:9: [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. (void)printf(i == 0 ? " & %.f" : " & %.1f", n); data/dfc-3.1.1/src/export/tex.c:346:9: [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. (void)printf(" & %" PRIu64, files); data/dfc-3.1.1/src/export/tex.c:349:9: [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. (void)printf(" & %" PRIu64, favail); data/dfc-3.1.1/src/export/tex.c:352:9: [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. (void)printf(" & %" PRIu64 " & %" PRIu64, files, favail); data/dfc-3.1.1/src/export/text.c:295:9: [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. (void)printf("%*" PRIu64, max.nbinodes - 1, files); data/dfc-3.1.1/src/export/text.c:298:9: [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. (void)printf("%*" PRIu64, max.avinodes - 1, favail); data/dfc-3.1.1/src/export/text.c:301:9: [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. (void)printf(" %*" PRIu64, max.nbinodes - 1, files); data/dfc-3.1.1/src/export/text.c:302:9: [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. (void)printf(" %*" PRIu64, max.avinodes - 1, favail); data/dfc-3.1.1/src/dfc.c:190:15: [3] (buffer) getopt: 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 ((ch = getopt(argc, argv, "abc:de:fhilmMnop:q:st:Tu:vwW")) != -1) { data/dfc-3.1.1/src/dotfile.c:88:13: [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. xdg_home = getenv("XDG_CONFIG_HOME"); data/dfc-3.1.1/src/dotfile.c:99:9: [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. home = getenv("HOME"); data/dfc-3.1.1/src/dotfile.c:85: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 conf[PATH_MAX]; data/dfc-3.1.1/src/dotfile.c:138: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[255]; data/dfc-3.1.1/src/dotfile.c:142: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). if ((fd = fopen(conf, "r")) == NULL) { data/dfc-3.1.1/src/extern.h:88: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 hcheadbg[HEXCOLOR_LEN + 1]; /* background color for header and footer (html) */ data/dfc-3.1.1/src/extern.h:89: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 hcheadfg[HEXCOLOR_LEN + 1]; /* font color used in header and footer (html) */ data/dfc-3.1.1/src/extern.h:90: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 hccellbg[HEXCOLOR_LEN + 1]; /* background color for cells (html) */ data/dfc-3.1.1/src/extern.h:91: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 hccellfg[HEXCOLOR_LEN + 1]; /* font color for cells (html) */ data/dfc-3.1.1/src/extern.h:92: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 hchoverbg[HEXCOLOR_LEN + 1]; /* background color on hover (html) */ data/dfc-3.1.1/src/extern.h:93: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 hchoverfg[HEXCOLOR_LEN + 1]; /* font color on hover (html) */ data/dfc-3.1.1/src/extern.h:94: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 hclow[HEXCOLOR_LEN + 1]; /* color when usage is low (html) */ data/dfc-3.1.1/src/extern.h:95: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 hcmedium[HEXCOLOR_LEN + 1]; /* color when usage is medium (html) */ data/dfc-3.1.1/src/extern.h:96: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 hchigh[HEXCOLOR_LEN + 1]; /* color when usage is high (html) */ data/dfc-3.1.1/src/platform/services-linux.c:93: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 ((mtab = fopen("/etc/mtab", "r")) == NULL) { data/dfc-3.1.1/src/platform/services-solaris.c:98: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 ((mnttab = fopen("/etc/mnttab", "r")) == NULL) { data/dfc-3.1.1/src/util.c:678: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 date[255]; data/dfc-3.1.1/src/dotfile.c:151: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). if (!strlen(strtrim(line)) || line[0] == '#') data/dfc-3.1.1/src/dotfile.c:259: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). if (strlen(val) == 1) data/dfc-3.1.1/src/dotfile.c:312: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). if (strlen(val) == 1) data/dfc-3.1.1/src/export/text.c:109: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). (int)strlen(_("(=) USED")) - (int)strlen(_("FREE (-)")); data/dfc-3.1.1/src/export/text.c:109:46: [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)strlen(_("(=) USED")) - (int)strlen(_("FREE (-)")); data/dfc-3.1.1/src/util.c:106:14: [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). end = str + strlen(str) - 1; data/dfc-3.1.1/src/util.c:123: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). int slen = (int)strlen(str); data/dfc-3.1.1/src/util.c:384:27: [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 (strncmp(fs, stropt, strlen(stropt)) == 0) { data/dfc-3.1.1/src/util.c:510: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). max.fsname = (int)strlen(_("FILESYSTEM")) + 1; data/dfc-3.1.1/src/util.c:511: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). max.fstype = Tflag ? (int)strlen(_("TYPE")) + 1 : 0; data/dfc-3.1.1/src/util.c:513: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). max.perctused = (int)strlen(_("%USED")) + 1; data/dfc-3.1.1/src/util.c:514:26: [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). max.used = dflag ? (int)strlen(_("USED")) + 1 : 0; data/dfc-3.1.1/src/util.c:515:19: [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). max.avail = (int)strlen(_("AVAILABLE")) + 1; data/dfc-3.1.1/src/util.c:516:19: [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). max.total = (int)strlen(_("TOTAL")) + 1; data/dfc-3.1.1/src/util.c:517:30: [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). max.nbinodes = iflag ? (int)strlen(_("#INODES")) + 1 : 0; data/dfc-3.1.1/src/util.c:518:30: [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). max.avinodes = iflag ? (int)strlen(_("AV.INODES")) + 1 : 0; data/dfc-3.1.1/src/util.c:519:32: [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). max.mntdir = Mflag ? 0 : (int)strlen(_("MOUNTED ON")) + 1; data/dfc-3.1.1/src/util.c:520:29: [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). max.mntopts = oflag ? (int)strlen(_("MOUNT OPTIONS")) + 1: 0; data/dfc-3.1.1/src/util.c:584:25: [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). max.fsname = imax((int)strlen(fmi->fsname) + 1, max.fsname); data/dfc-3.1.1/src/util.c:585:25: [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). max.fstype = imax((int)strlen(fmi->fstype) + 1, max.fstype); data/dfc-3.1.1/src/util.c:588:26: [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). max.mntdir = imax((int)strlen(fmi->mntdir) + 1, max.mntdir); data/dfc-3.1.1/src/util.c:591:27: [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). max.mntopts = imax((int)strlen(fmi->mntopts) + 1, max.mntopts); data/dfc-3.1.1/src/util.c:767: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). if (strlen(color) != HEXCOLOR_LEN) ANALYSIS SUMMARY: Hits = 63 Lines analyzed = 5158 in approximately 0.16 seconds (31757 lines/second) Physical Source Lines of Code (SLOC) = 3302 Hits@level = [0] 224 [1] 23 [2] 15 [3] 3 [4] 22 [5] 0 Hits@level+ = [0+] 287 [1+] 63 [2+] 40 [3+] 25 [4+] 22 [5+] 0 Hits/KSLOC@level+ = [0+] 86.917 [1+] 19.0793 [2+] 12.1139 [3+] 7.57117 [4+] 6.66263 [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.