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/onesixtyone-0.3.3~git20190328/onesixtyone.c FINAL RESULTS: data/onesixtyone-0.3.3~git20190328/onesixtyone.c:399:3: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy((buf + 7), target_community); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:439:5: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(fmt, args2); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:444:5: [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(o.log_fd, fmt, args); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:277:17: [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 ((arg = getopt(argc, argv, "c:di:o:p:s:w:q")) != EOF) { data/onesixtyone-0.3.3~git20190328/onesixtyone.c:115:13: [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 ((fd = fopen(filename, "r")) == 0) { data/onesixtyone-0.3.3~git20190328/onesixtyone.c:165:15: [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). netmask = atoi(slash + 1); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:211: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 buf[100]; data/onesixtyone-0.3.3~git20190328/onesixtyone.c:221: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). if ((fd = fopen(filename, "r")) == 0) { data/onesixtyone-0.3.3~git20190328/onesixtyone.c:258: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 community_filename[250]; data/onesixtyone-0.3.3~git20190328/onesixtyone.c:259: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 input_filename[250]; data/onesixtyone-0.3.3~git20190328/onesixtyone.c:260: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 log_filename[255]; data/onesixtyone-0.3.3~git20190328/onesixtyone.c:301:25: [2] (integer) atol: 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). case 'w': o.wait = atol(optarg); /* convert to nanoseconds */ data/onesixtyone-0.3.3~git20190328/onesixtyone.c:352: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). if ((o.log_fd = fopen(log_filename, "w")) == 0) { data/onesixtyone-0.3.3~git20190328/onesixtyone.c:425:3: [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((char*)&buf[i], &object, sizeof(object) - 1); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:843: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 buf[1500]; data/onesixtyone-0.3.3~git20190328/onesixtyone.c:902: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 sendbuf[1500]; data/onesixtyone-0.3.3~git20190328/onesixtyone.c:132:23: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). for (c = 0; (ch = fgetc(fd)) != EOF && !isspace(ch); ++c) { data/onesixtyone-0.3.3~git20190328/onesixtyone.c:231:10: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ch = fgetc(fd); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:280:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(community_filename, optarg, sizeof(community_filename)); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:285:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(input_filename, optarg, sizeof(input_filename)); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:288:7: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(log_filename, optarg, sizeof(log_filename)); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:378:12: [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 (21 + strlen(target_community) + strlen(object) > buf_size) { data/onesixtyone-0.3.3~git20190328/onesixtyone.c:378:39: [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 (21 + strlen(target_community) + strlen(object) > buf_size) { data/onesixtyone-0.3.3~git20190328/onesixtyone.c:388:17: [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). buf[1] = 19 + strlen(target_community) + sizeof(object) - 1; data/onesixtyone-0.3.3~git20190328/onesixtyone.c:397:12: [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). buf[6] = strlen(target_community); data/onesixtyone-0.3.3~git20190328/onesixtyone.c:400:11: [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). i = 7 + strlen(target_community); ANALYSIS SUMMARY: Hits = 26 Lines analyzed = 959 in approximately 0.05 seconds (21278 lines/second) Physical Source Lines of Code (SLOC) = 770 Hits@level = [0] 54 [1] 10 [2] 12 [3] 1 [4] 3 [5] 0 Hits@level+ = [0+] 80 [1+] 26 [2+] 16 [3+] 4 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 103.896 [1+] 33.7662 [2+] 20.7792 [3+] 5.19481 [4+] 3.8961 [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.