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/disk-filltest-0.8.2/disk-filltest.c FINAL RESULTS: data/disk-filltest-0.8.2/disk-filltest.c:191:19: [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, "hs:S:f:ruUC:NR:V")) != -1) { data/disk-filltest-0.8.2/disk-filltest.c:126:36: [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. void format_time(unsigned int sec, char output[64]) data/disk-filltest-0.8.2/disk-filltest.c:136:9: [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(output, "%ud%uh%um%us", days, hours, minutes, sec); data/disk-filltest-0.8.2/disk-filltest.c:143:9: [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(output, "%uh%um%us", hours, minutes, sec); data/disk-filltest-0.8.2/disk-filltest.c:148:9: [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(output, "%um%us", minutes, sec); data/disk-filltest-0.8.2/disk-filltest.c:151:9: [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(output, "%us", sec); data/disk-filltest-0.8.2/disk-filltest.c:194:22: [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). g_seed = atoi(optarg); data/disk-filltest-0.8.2/disk-filltest.c:197:30: [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). gopt_file_size = atoi(optarg); data/disk-filltest-0.8.2/disk-filltest.c:200:31: [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). gopt_file_limit = atoi(optarg); data/disk-filltest-0.8.2/disk-filltest.c:221:27: [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). gopt_repeat = atoi(optarg); data/disk-filltest-0.8.2/disk-filltest.c:246:9: [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 filename[32]; data/disk-filltest-0.8.2/disk-filltest.c:247:9: [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(filename, "random-%08u", filenum); data/disk-filltest-0.8.2/disk-filltest.c:293:9: [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 filename[32], eta[64]; data/disk-filltest-0.8.2/disk-filltest.c:303:9: [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(filename, "random-%08u", filenum); data/disk-filltest-0.8.2/disk-filltest.c:305:14: [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). fd = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_BINARY, 0600); data/disk-filltest-0.8.2/disk-filltest.c:390:9: [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 filename[32]; data/disk-filltest-0.8.2/disk-filltest.c:395:13: [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(filename, "random-%08u", expected_file_limit); data/disk-filltest-0.8.2/disk-filltest.c:396:18: [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). fd = open(filename, O_RDONLY | O_BINARY); data/disk-filltest-0.8.2/disk-filltest.c:408:9: [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 filename[32], eta[64]; data/disk-filltest-0.8.2/disk-filltest.c:418:9: [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(filename, "random-%08u", filenum); data/disk-filltest-0.8.2/disk-filltest.c:437:18: [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). fd = open(filename, O_RDONLY | O_BINARY); data/disk-filltest-0.8.2/disk-filltest.c:458:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). rb = read(fd, block, read_size); ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 545 in approximately 0.06 seconds (9196 lines/second) Physical Source Lines of Code (SLOC) = 404 Hits@level = [0] 22 [1] 1 [2] 20 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 44 [1+] 22 [2+] 21 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 108.911 [1+] 54.4554 [2+] 51.9802 [3+] 2.47525 [4+] 0 [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.