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/pnscan-1.14.1/bm.c Examining data/pnscan-1.14.1/bm.h Examining data/pnscan-1.14.1/pnscan.c Examining data/pnscan-1.14.1/t_listen.c FINAL RESULTS: data/pnscan-1.14.1/t_listen.c:72:13: [3] (random) random: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. port = (random()%port_len)+port_base; data/pnscan-1.14.1/pnscan.c:555:14: [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. unsigned char buf[RESPONSE_MAX_SIZE]; data/pnscan-1.14.1/pnscan.c:819:5: [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[1024]; data/pnscan-1.14.1/pnscan.c:965:5: [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 first[1024], last[1024]; data/pnscan-1.14.1/pnscan.c:1018:5: [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 first[256]; data/pnscan-1.14.1/pnscan.c:1019:5: [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 last[256]; data/pnscan-1.14.1/pnscan.c:1137:24: [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. wstr = (unsigned char *) strdup(argv[i]+2); data/pnscan-1.14.1/pnscan.c:1139:24: [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. wstr = (unsigned char *) strdup(argv[++i]); data/pnscan-1.14.1/pnscan.c:1152:24: [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. wstr = (unsigned char *) strdup(argv[i]+2); data/pnscan-1.14.1/pnscan.c:1154:24: [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. wstr = (unsigned char *) strdup(argv[++i]); data/pnscan-1.14.1/pnscan.c:1167:24: [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. rstr = (unsigned char *) strdup(argv[i]+2); data/pnscan-1.14.1/pnscan.c:1169:24: [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. rstr = (unsigned char *) strdup(argv[++i]); data/pnscan-1.14.1/pnscan.c:1182:24: [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. rstr = (unsigned char *) strdup(argv[i]+2); data/pnscan-1.14.1/pnscan.c:1184:24: [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. rstr = (unsigned char *) strdup(argv[++i]); data/pnscan-1.14.1/t_listen.c:101:8: [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). dup2(open("/dev/null", O_RDONLY), 0); data/pnscan-1.14.1/t_listen.c:103:8: [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). dup2(open("/dev/null", O_WRONLY), 1); data/pnscan-1.14.1/bm.c:227:23: [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). bm_setup(argv[1], strlen(argv[1])); data/pnscan-1.14.1/bm.c:229:30: [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). pos = bm_search(argv[2], strlen(argv[2])); data/pnscan-1.14.1/pnscan.c:322:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read(fd, buf, size)) < 0 && errno == EINTR) data/pnscan-1.14.1/pnscan.c:990:13: [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. switch (sscanf(str, "%1023[^: ] : %1023s", first, last)) data/pnscan-1.14.1/pnscan.c:1025:13: [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. switch (sscanf(str, "%255[^: ] : %255s", first, last)) data/pnscan-1.14.1/t_listen.c:115:24: [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). if (write(r_fd, msg, strlen(msg)) < 0) ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 1738 in approximately 0.05 seconds (35861 lines/second) Physical Source Lines of Code (SLOC) = 1216 Hits@level = [0] 88 [1] 6 [2] 15 [3] 1 [4] 0 [5] 0 Hits@level+ = [0+] 110 [1+] 22 [2+] 16 [3+] 1 [4+] 0 [5+] 0 Hits/KSLOC@level+ = [0+] 90.4605 [1+] 18.0921 [2+] 13.1579 [3+] 0.822368 [4+] 0 [5+] 0 Dot directories skipped = 2 (--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.