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/exfat-utils-1.3.0/libexfat/byteorder.h Examining data/exfat-utils-1.3.0/libexfat/cluster.c Examining data/exfat-utils-1.3.0/libexfat/compiler.h Examining data/exfat-utils-1.3.0/libexfat/exfat.h Examining data/exfat-utils-1.3.0/libexfat/exfatfs.h Examining data/exfat-utils-1.3.0/libexfat/io.c Examining data/exfat-utils-1.3.0/libexfat/log.c Examining data/exfat-utils-1.3.0/libexfat/lookup.c Examining data/exfat-utils-1.3.0/libexfat/mount.c Examining data/exfat-utils-1.3.0/libexfat/node.c Examining data/exfat-utils-1.3.0/libexfat/platform.h Examining data/exfat-utils-1.3.0/libexfat/repair.c Examining data/exfat-utils-1.3.0/libexfat/time.c Examining data/exfat-utils-1.3.0/libexfat/utf.c Examining data/exfat-utils-1.3.0/libexfat/utils.c Examining data/exfat-utils-1.3.0/dump/main.c Examining data/exfat-utils-1.3.0/fsck/main.c Examining data/exfat-utils-1.3.0/label/main.c Examining data/exfat-utils-1.3.0/mkfs/cbm.c Examining data/exfat-utils-1.3.0/mkfs/cbm.h Examining data/exfat-utils-1.3.0/mkfs/fat.c Examining data/exfat-utils-1.3.0/mkfs/fat.h Examining data/exfat-utils-1.3.0/mkfs/main.c Examining data/exfat-utils-1.3.0/mkfs/mkexfat.c Examining data/exfat-utils-1.3.0/mkfs/mkexfat.h Examining data/exfat-utils-1.3.0/mkfs/rootdir.c Examining data/exfat-utils-1.3.0/mkfs/rootdir.h Examining data/exfat-utils-1.3.0/mkfs/uct.c Examining data/exfat-utils-1.3.0/mkfs/uct.h Examining data/exfat-utils-1.3.0/mkfs/uctc.c Examining data/exfat-utils-1.3.0/mkfs/uctc.h Examining data/exfat-utils-1.3.0/mkfs/vbr.c Examining data/exfat-utils-1.3.0/mkfs/vbr.h FINAL RESULTS: data/exfat-utils-1.3.0/dump/main.c:113:3: [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. printf(" %"PRIu64"-%"PRIu64, a, b); data/exfat-utils-1.3.0/fsck/main.c:91: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(entry_path, path); data/exfat-utils-1.3.0/libexfat/compiler.h:33:38: [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. #define PRINTF __attribute__((format(printf, 1, 2))) data/exfat-utils-1.3.0/libexfat/compiler.h:42:38: [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. #define PRINTF __attribute__((format(printf, 1, 2))) data/exfat-utils-1.3.0/libexfat/log.c:46:2: [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, format, ap); data/exfat-utils-1.3.0/libexfat/log.c:74:2: [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, format, ap); data/exfat-utils-1.3.0/libexfat/log.c:100:2: [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, format, ap); data/exfat-utils-1.3.0/libexfat/log.c:123:2: [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, format, ap); data/exfat-utils-1.3.0/libexfat/node.c:1224: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(ef->label, label); data/exfat-utils-1.3.0/dump/main.c:214:16: [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 ((opt = getopt(argc, argv, "suf:V")) != -1) data/exfat-utils-1.3.0/fsck/main.c:164:16: [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 ((opt = getopt(argc, argv, "anpVy")) != -1) data/exfat-utils-1.3.0/mkfs/main.c:209:16: [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 ((opt = getopt(argc, argv, "i:n:p:s:V")) != -1) data/exfat-utils-1.3.0/fsck/main.c:44:4: [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[EXFAT_UTF8_NAME_BUFFER_MAX]; data/exfat-utils-1.3.0/fsck/main.c:53:4: [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[EXFAT_UTF8_NAME_BUFFER_MAX]; data/exfat-utils-1.3.0/libexfat/exfat.h:121: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 label[EXFAT_UTF8_ENAME_BUFFER_MAX]; data/exfat-utils-1.3.0/libexfat/exfat.h:193: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 buffer[EXFAT_UTF8_NAME_BUFFER_MAX]); data/exfat-utils-1.3.0/libexfat/io.c:64:9: [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). return open(spec, O_RDONLY); data/exfat-utils-1.3.0/libexfat/io.c:69: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). int fd = open(spec, O_RDWR); data/exfat-utils-1.3.0/libexfat/io.c:106:7: [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). if (open("/dev/null", O_RDWR) == -1) data/exfat-utils-1.3.0/libexfat/node.c:40: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 buffer[EXFAT_UTF8_NAME_BUFFER_MAX]; data/exfat-utils-1.3.0/libexfat/node.c:158: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(node->name + i * EXFAT_ENAME_MAX, data/exfat-utils-1.3.0/libexfat/node.c:214: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 buffer[EXFAT_UTF8_NAME_BUFFER_MAX]; data/exfat-utils-1.3.0/libexfat/node.c:594: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 buffer[EXFAT_UTF8_NAME_BUFFER_MAX]; data/exfat-utils-1.3.0/libexfat/node.c:916: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(name_entry->name, name + i * EXFAT_ENAME_MAX, data/exfat-utils-1.3.0/libexfat/node.c:929: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(node->name, name, name_length * sizeof(le16_t)); data/exfat-utils-1.3.0/libexfat/node.c:1042: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(name_entry->name, name + i * EXFAT_ENAME_MAX, data/exfat-utils-1.3.0/libexfat/node.c:1051: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(node->name, name, (EXFAT_NAME_MAX + 1) * sizeof(le16_t)); data/exfat-utils-1.3.0/libexfat/repair.c:31: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 answer[8]; data/exfat-utils-1.3.0/libexfat/utils.c:49: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 buffer[EXFAT_UTF8_NAME_BUFFER_MAX]) data/exfat-utils-1.3.0/mkfs/main.c:223:26: [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). spc_bits = logarithm2(atoi(optarg)); data/exfat-utils-1.3.0/mkfs/rootdir.c:47: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(label_entry->name, get_volume_label(), data/exfat-utils-1.3.0/fsck/main.c:83: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). path_length = strlen(path); data/exfat-utils-1.3.0/fsck/main.c:92:2: [1] (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 character. strcat(entry_path, "/"); data/exfat-utils-1.3.0/libexfat/io.c:337:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). return read(dev->fd, buffer, size); data/exfat-utils-1.3.0/libexfat/lookup.c:116:10: [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). return strlen(*comp); data/exfat-utils-1.3.0/libexfat/mount.c:64: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). size_t length = strlen(option_name); data/exfat-utils-1.3.0/libexfat/mount.c:85: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). size_t length = strlen(option_name); data/exfat-utils-1.3.0/libexfat/node.c:1204:62: [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). rc = utf8_to_utf16(label_utf16, label, EXFAT_ENAME_MAX + 1, strlen(label)); data/exfat-utils-1.3.0/mkfs/main.c:139:54: [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). return utf8_to_utf16(label, s, EXFAT_ENAME_MAX + 1, strlen(s)); ANALYSIS SUMMARY: Hits = 39 Lines analyzed = 6618 in approximately 0.23 seconds (29396 lines/second) Physical Source Lines of Code (SLOC) = 5092 Hits@level = [0] 41 [1] 8 [2] 19 [3] 3 [4] 9 [5] 0 Hits@level+ = [0+] 80 [1+] 39 [2+] 31 [3+] 12 [4+] 9 [5+] 0 Hits/KSLOC@level+ = [0+] 15.7109 [1+] 7.65907 [2+] 6.08798 [3+] 2.35664 [4+] 1.76748 [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.