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/physlock-13/config.def.h Examining data/physlock-13/main.c Examining data/physlock-13/options.c Examining data/physlock-13/physlock.h Examining data/physlock-13/session.c Examining data/physlock-13/util.c Examining data/physlock-13/vt.c FINAL RESULTS: data/physlock-13/util.c:45: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/physlock-13/options.c:49: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, "dhLlmp:sv")) != -1) { data/physlock-13/session.c:54: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 tty[UT_LINESIZE+1], name[UT_NAMESIZE+1]; data/physlock-13/session.c:57:15: [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). while ((uf = fopen(_PATH_UTMP, "r")) == NULL && errno == EINTR); data/physlock-13/util.c:62: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(d, s, n); data/physlock-13/util.c:76:21: [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). while ((ctl_file = fopen(path, "r")) == NULL && errno == EINTR); data/physlock-13/util.c:98:21: [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). while ((ctl_file = fopen(path, "w+")) == NULL && errno == EINTR); data/physlock-13/util.c:119: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 buf[32], *end; data/physlock-13/util.c:136: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 buf[32]; data/physlock-13/vt.c:33: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. static char filename[1024]; data/physlock-13/vt.c:36:15: [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). while ((fd = open(CONSOLE_DEVICE, O_RDWR)) == -1 && errno == EINTR); data/physlock-13/vt.c:88:20: [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). while ((vt->ios = fopen(filename, "r+")) == NULL && errno == EINTR); data/physlock-13/session.c:67:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(name, r.ut_user, UT_NAMESIZE); data/physlock-13/util.c:57:13: [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 n = strlen(s) + 1; data/physlock-13/util.c:139:31: [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 write_file(path, buf, strlen(buf)); ANALYSIS SUMMARY: Hits = 15 Lines analyzed = 791 in approximately 0.03 seconds (26286 lines/second) Physical Source Lines of Code (SLOC) = 532 Hits@level = [0] 14 [1] 3 [2] 10 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 29 [1+] 15 [2+] 12 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 54.5113 [1+] 28.1955 [2+] 22.5564 [3+] 3.7594 [4+] 1.8797 [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.