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/pick-2.0.2/compat-strtonum.c Examining data/pick-2.0.2/compat.h Examining data/pick-2.0.2/pick.c Examining data/pick-2.0.2/tests/pick-test.c Examining data/pick-2.0.2/compat-reallocarray.c FINAL RESULTS: data/pick-2.0.2/tests/pick-test.c:181:2: [4] (shell) execv: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. execv(pickargv[0], pickargv); data/pick-2.0.2/pick.c:132:14: [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 ((c = getopt(argc, argv, "dhoq:KSvxX")) != -1) data/pick-2.0.2/pick.c:231: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. if ((ifs = getenv("IFS")) == NULL || *ifs == '\0') data/pick-2.0.2/pick.c:762:12: [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. if ((cp = getenv("COLUMNS")) != NULL && data/pick-2.0.2/pick.c:765:12: [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. if ((cp = getenv("LINES")) != NULL && data/pick-2.0.2/tests/pick-test.c:42:14: [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 ((c = getopt(argc, argv, "k:")) != -1) data/pick-2.0.2/pick.c:502:4: [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(query + cursor_position, buf, length); data/pick-2.0.2/pick.c:668:26: [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 (doinit && (tty_in = fopen("/dev/tty", "r")) == NULL) data/pick-2.0.2/pick.c:680:27: [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 (doinit && (tty_out = fopen("/dev/tty", "w")) == NULL) data/pick-2.0.2/pick.c:954:18: [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 unsigned char buf[8]; data/pick-2.0.2/tests/pick-test.c:68: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). if ((slave = open(ptsname(master), O_RDWR)) == -1) data/pick-2.0.2/tests/pick-test.c:107: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 ((fh = fopen(path, "r")) == NULL) data/pick-2.0.2/tests/pick-test.c:154:12: [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 ((fd = open("/dev/tty", O_RDWR | O_NOCTTY)) >= 0) { data/pick-2.0.2/tests/pick-test.c:188: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[BUFSIZ]; data/pick-2.0.2/pick.c:152: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). query_length = strlen(query); data/pick-2.0.2/pick.c:237:12: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((n = read(STDIN_FILENO, buf + length, size - length)) == -1) data/pick-2.0.2/pick.c:488: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). length = strlen(buf); data/pick-2.0.2/pick.c:986: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). keys[i].len = strlen(keys[i].str); data/pick-2.0.2/pick.c:1047:11: [1] (buffer) getc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((c = getc(tty_in)) == ERR && !gotsigwinch) data/pick-2.0.2/tests/pick-test.c:114:14: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((c = fgetc(fh)) != EOF) { data/pick-2.0.2/tests/pick-test.c:195: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). len = strlen(keys); data/pick-2.0.2/tests/pick-test.c:220:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read(master, buf, sizeof(buf)) == -1) ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 1519 in approximately 0.07 seconds (22258 lines/second) Physical Source Lines of Code (SLOC) = 1162 Hits@level = [0] 4 [1] 8 [2] 8 [3] 5 [4] 1 [5] 0 Hits@level+ = [0+] 26 [1+] 22 [2+] 14 [3+] 6 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 22.3752 [1+] 18.9329 [2+] 12.0482 [3+] 5.16351 [4+] 0.860585 [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.