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/ipcalc-ng-0.4.1/ipcalc-reverse.c Examining data/ipcalc-ng-0.4.1/ipcalc-utils.c Examining data/ipcalc-ng-0.4.1/ipcalc.h Examining data/ipcalc-ng-0.4.1/ipv6.c Examining data/ipcalc-ng-0.4.1/ipv6.h Examining data/ipcalc-ng-0.4.1/deaggregate.c Examining data/ipcalc-ng-0.4.1/ipcalc-geoip.c Examining data/ipcalc-ng-0.4.1/ipcalc-maxmind.c Examining data/ipcalc-ng-0.4.1/netsplit.c Examining data/ipcalc-ng-0.4.1/ipcalc.c FINAL RESULTS: data/ipcalc-ng-0.4.1/ipcalc-utils.c:27:31: [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. int __attribute__((__format__(printf, 2, 3))) safe_asprintf(char **strp, const char *fmt, ...) data/ipcalc-ng-0.4.1/ipcalc.c:722:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(errBuf, data/ipcalc-ng-0.4.1/ipcalc.c:987:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(errBuf, data/ipcalc-ng-0.4.1/ipcalc.c:1239:24: [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. __attribute__ ((format(printf, 3, 4))) data/ipcalc-ng-0.4.1/ipcalc.c:1276:24: [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. __attribute__ ((format(printf, 3, 4))) data/ipcalc-ng-0.4.1/ipcalc.c:1317:24: [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. __attribute__ ((format(printf, 4, 5))) data/ipcalc-ng-0.4.1/ipcalc.c:1324:3: [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, args); data/ipcalc-ng-0.4.1/ipcalc.c:1337:24: [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. __attribute__ ((format(printf, 4, 5))) data/ipcalc-ng-0.4.1/ipcalc.c:1810:5: [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. printf(ADDRESS_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1817:5: [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. printf(NETMASK_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1824:5: [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. printf(PREFIX_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1831:5: [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. printf(BROADCAST_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1838:5: [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. printf(NETWORK_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1845:5: [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. printf(REVERSEDNS_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1852:5: [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. printf(MINADDR_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1859:5: [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. printf(MAXADDR_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1866:5: [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. printf(ADDRSPACE_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1876:5: [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. printf(ADDRESSES_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1886:5: [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. printf(HOSTNAME_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1893:5: [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. printf(ADDRESS_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1901:6: [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. printf(COUNTRYCODE_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1907:6: [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. printf(COUNTRY_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1916:6: [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. printf(CITY_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.c:1926:6: [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. printf(COORDINATES_NAME"="); data/ipcalc-ng-0.4.1/ipcalc.h:41:31: [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. int __attribute__((__format__(printf, 2, 3))) safe_asprintf(char **strp, const char *fmt, ...); data/ipcalc-ng-0.4.1/ipcalc.h:132:24: [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. __attribute__ ((format(printf, 3, 4))) data/ipcalc-ng-0.4.1/ipcalc.h:135:24: [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. __attribute__ ((format(printf, 3, 4))) data/ipcalc-ng-0.4.1/ipcalc.h:141:24: [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. __attribute__ ((format(printf, 4, 5))) data/ipcalc-ng-0.4.1/ipcalc.h:144:24: [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. __attribute__ ((format(printf, 4, 5))) data/ipcalc-ng-0.4.1/ipcalc.c:1397:7: [3] (buffer) getopt_long: 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. c = getopt_long(argc, argv, "S:cr:i46abho:gmnpjsvd:", long_options, NULL); data/ipcalc-ng-0.4.1/deaggregate.c:88: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 namebuf[INET_ADDRSTRLEN + 1] = {0}; data/ipcalc-ng-0.4.1/deaggregate.c:155: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 namebuf[INET6_ADDRSTRLEN + 1] = {0}; data/ipcalc-ng-0.4.1/ipcalc-geoip.c:69:9: [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 err[256] = {0}; data/ipcalc-ng-0.4.1/ipcalc-maxmind.c:69:9: [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 err[256] = {0}; data/ipcalc-ng-0.4.1/ipcalc-maxmind.c:118:21: [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(*output, entry_data->utf8_string, entry_data->data_size); data/ipcalc-ng-0.4.1/ipcalc-reverse.c:104: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 str[256]; data/ipcalc-ng-0.4.1/ipcalc-reverse.c:124:2: [2] (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). Risk is low because the source is a constant string. strcpy(&str[j], "ip6.arpa."); data/ipcalc-ng-0.4.1/ipcalc.c:150:9: [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 hostname[NI_MAXHOST]; data/ipcalc-ng-0.4.1/ipcalc.c:158: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(&addr4.sin_addr, addr, sizeof(struct in_addr)); data/ipcalc-ng-0.4.1/ipcalc.c:163: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(&addr6.sin6_addr, addr, sizeof(struct in6_addr)); data/ipcalc-ng-0.4.1/ipcalc.c:188:9: [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 ipname[64]; data/ipcalc-ng-0.4.1/ipcalc.c:586: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 namebuf[INET_ADDRSTRLEN + 1]; data/ipcalc-ng-0.4.1/ipcalc.c:587: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 errBuf[250]; data/ipcalc-ng-0.4.1/ipcalc.c:692: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(&maxhost, &network, sizeof(minhost)); data/ipcalc-ng-0.4.1/ipcalc.c:750: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(mask, &in6, sizeof(*mask)); data/ipcalc-ng-0.4.1/ipcalc.c:756: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[128]; data/ipcalc-ng-0.4.1/ipcalc.c:872: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[128]; data/ipcalc-ng-0.4.1/ipcalc.c:878:3: [2] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. Risk is low because the source has a constant maximum length. sprintf(p, "%.2x", (unsigned)ip6->s6_addr[i]); data/ipcalc-ng-0.4.1/ipcalc.c:895: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 errBuf[250]; data/ipcalc-ng-0.4.1/ipcalc.c:1002:7: [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). fd = open("/dev/urandom", O_RDONLY); data/ipcalc-ng-0.4.1/ipcalc.c:1019: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 ipbuf[64]; data/ipcalc-ng-0.4.1/ipcalc.c:1055: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(&net.s_addr, bytes, 4); data/ipcalc-ng-0.4.1/ipcalc.h:70: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 hosts[64]; /* number of hosts in text */ data/ipcalc-ng-0.4.1/netsplit.c:41:9: [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 quad[64]; data/ipcalc-ng-0.4.1/netsplit.c:49: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[64]; data/ipcalc-ng-0.4.1/netsplit.c:129:9: [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 str[64]; data/ipcalc-ng-0.4.1/netsplit.c:139: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/ipcalc-ng-0.4.1/netsplit.c:192: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(&start, &net, sizeof(net)); data/ipcalc-ng-0.4.1/netsplit.c:193: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(&ediff, &sdiff, sizeof(sdiff)); data/ipcalc-ng-0.4.1/deaggregate.c:38: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(str); data/ipcalc-ng-0.4.1/ipcalc.c:1006:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(fd, ptr, size); ANALYSIS SUMMARY: Hits = 61 Lines analyzed = 3359 in approximately 0.15 seconds (22450 lines/second) Physical Source Lines of Code (SLOC) = 2529 Hits@level = [0] 143 [1] 2 [2] 29 [3] 1 [4] 29 [5] 0 Hits@level+ = [0+] 204 [1+] 61 [2+] 59 [3+] 30 [4+] 29 [5+] 0 Hits/KSLOC@level+ = [0+] 80.6643 [1+] 24.1202 [2+] 23.3294 [3+] 11.8624 [4+] 11.467 [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.