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/pagein-0.01.05/pagein.c FINAL RESULTS: data/pagein-0.01.05/pagein.c:118:8: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. (sscanf(buffer, "%*s %" SCNd64, memfree) == 1)) { data/pagein-0.01.05/pagein.c:123:8: [4] (buffer) sscanf: The scanf() family's %s operation, without a limit specification, permits buffer overflows (CWE-120, CWE-20). Specify a limit to %s, or use a different input function. If the scanf format is influenceable by an attacker, it's exploitable. (sscanf(buffer, "%*s %" SCNd64, swapfree) == 1)) { data/pagein-0.01.05/pagein.c:140: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(APP_NAME ":\n"); data/pagein-0.01.05/pagein.c:313:11: [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. int c = getopt(argc, argv, "ahp:v"); data/pagein-0.01.05/pagein.c:106: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[4096]; data/pagein-0.01.05/pagein.c:112:7: [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). fp = fopen("/proc/meminfo", "r"); data/pagein-0.01.05/pagein.c:161: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 path[PATH_MAX]; data/pagein-0.01.05/pagein.c:162: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[4096]; data/pagein-0.01.05/pagein.c:172:10: [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). fdmem = open(path, O_RDONLY); data/pagein-0.01.05/pagein.c:179:10: [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). fpmap = fopen(path, "r"); data/pagein-0.01.05/pagein.c:199: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 tmppath[1024]; data/pagein-0.01.05/pagein.c:200: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 prot[5]; data/pagein-0.01.05/pagein.c:327:10: [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). pid = atoi(optarg); data/pagein-0.01.05/pagein.c:202:7: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. if (sscanf(buffer, "%" SCNx64 "-%" SCNx64 data/pagein-0.01.05/pagein.c:226:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). sz = read(fdmem, &data, sizeof data); ANALYSIS SUMMARY: Hits = 15 Lines analyzed = 421 in approximately 0.02 seconds (19583 lines/second) Physical Source Lines of Code (SLOC) = 318 Hits@level = [0] 31 [1] 2 [2] 9 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 46 [1+] 15 [2+] 13 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 144.654 [1+] 47.1698 [2+] 40.8805 [3+] 12.5786 [4+] 9.43396 [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.