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/iptables-netflow-2.5.1/compat.h Examining data/iptables-netflow-2.5.1/ipt_NETFLOW.h Examining data/iptables-netflow-2.5.1/libipt_NETFLOW.c Examining data/iptables-netflow-2.5.1/murmur3.h Examining data/iptables-netflow-2.5.1/snmp_NETFLOW.c Examining data/iptables-netflow-2.5.1/ipt_NETFLOW.c FINAL RESULTS: data/iptables-netflow-2.5.1/ipt_NETFLOW.c:2194:3: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(sampler_buf, "%s:%u", sampler_mode_string(), interval); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:180:6: [4] (race) access: This usually indicates a security flaw. If an attacker can change anything along the path between the call to access() and the file's actual use (e.g., by moving files), the attacker can exploit the race condition (CWE-362/CWE-367!). Set up the correct permissions (e.g., using setuid()) and try to open the file directly. if (access(fname, W_OK) < 0) data/iptables-netflow-2.5.1/compat.h:477: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(dst, dbuf, sizeof(dbuf)); data/iptables-netflow-2.5.1/compat.h:591: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(dst, dbuf, sizeof(dbuf)); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:109: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 version_string[128]; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:114: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 destination_buf[DST_SIZE] = "127.0.0.1:2055"; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:120: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 sampler_buf[128] = ""; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:194: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 snmp_rules_buf[DST_SIZE] = ""; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:224: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 aggregation_buf[AGGR_SIZE] = ""; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:473: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 buf[64]; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:493: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 buf[128]; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:1015: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(cf, nf, sizeof(*cf)); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:2272: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(dst, prefix, len); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:2292:3: [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(snmp_rules_buf, "parse error"); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:2297:3: [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(snmp_rules_buf, "no memory"); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:2358: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 name[IFNAMSIZ] = { 0 }; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:2457:12: [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 ip[4]; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3598:30: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case destinationMacAddress: memcpy(ptr, &nf->tuple.h_dst, ETH_ALEN); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3599:29: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case sourceMacAddress: memcpy(ptr, &nf->tuple.h_src, ETH_ALEN); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3606:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_1: memcpy(ptr, &nf->tuple.mpls[0], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3607:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_2: memcpy(ptr, &nf->tuple.mpls[1], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3608:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_3: memcpy(ptr, &nf->tuple.mpls[2], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3610:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_4: memcpy(ptr, &nf->tuple.mpls[3], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3611:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_5: memcpy(ptr, &nf->tuple.mpls[4], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3612:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_6: memcpy(ptr, &nf->tuple.mpls[5], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3613:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_7: memcpy(ptr, &nf->tuple.mpls[6], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3614:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_8: memcpy(ptr, &nf->tuple.mpls[7], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3615:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_9: memcpy(ptr, &nf->tuple.mpls[8], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3616:24: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case MPLS_LABEL_10: memcpy(ptr, &nf->tuple.mpls[9], 3); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:3912:35: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. case observationDomainName: memcpy(ptr, version_string, version_string_size + 1); break; data/iptables-netflow-2.5.1/ipt_NETFLOW.c:4889: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(&tuple->h_dst, eth_hdr(skb)->h_dest, ETH_ALEN); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:4890: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(&tuple->h_src, eth_hdr(skb)->h_source, ETH_ALEN); data/iptables-netflow-2.5.1/ipt_NETFLOW.h:382: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 sdev[IFNAMSIZ]; // source device data/iptables-netflow-2.5.1/snmp_NETFLOW.c:177: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 fname[64]; data/iptables-netflow-2.5.1/snmp_NETFLOW.c:187:11: [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). int fd = open(name, O_RDONLY); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:202: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 fname[64]; data/iptables-netflow-2.5.1/snmp_NETFLOW.c:210: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 fname[64]; data/iptables-netflow-2.5.1/snmp_NETFLOW.c:218: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 fname[64]; data/iptables-netflow-2.5.1/snmp_NETFLOW.c:223: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(fname, O_RDWR, 0644); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:234: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[225]; data/iptables-netflow-2.5.1/snmp_NETFLOW.c:247:11: [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). value = atoi(p); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:266: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[225]; data/iptables-netflow-2.5.1/snmp_NETFLOW.c:301: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[225]; data/iptables-netflow-2.5.1/snmp_NETFLOW.c:340:11: [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). value = atoi(p); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:469: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 buf[4096]; data/iptables-netflow-2.5.1/snmp_NETFLOW.c:477: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("/proc/net/stat/ipt_netflow_snmp", O_RDONLY)) < 0) data/iptables-netflow-2.5.1/snmp_NETFLOW.c:502:20: [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). parse_table_row(atoi(name + 3), val, cputable, cpu_data_set); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:505:20: [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). parse_table_row(atoi(name + 4), val, socktable, sock_data_set); data/iptables-netflow-2.5.1/compat.h:443: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). srclen = strlen(src); data/iptables-netflow-2.5.1/compat.h:501: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). srclen = strlen(src); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:499:9: [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(buf); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:502:9: [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(buf); data/iptables-netflow-2.5.1/ipt_NETFLOW.c:508:9: [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(buf); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:190:10: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int n = read(fd, buf, size - 1); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:287: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(buf); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:439:32: [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). sys->type, (char *)val, strlen(val)); data/iptables-netflow-2.5.1/snmp_NETFLOW.c:480:6: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). n = read(fd, buf, sizeof(buf) - 1); ANALYSIS SUMMARY: Hits = 57 Lines analyzed = 7891 in approximately 0.24 seconds (32503 lines/second) Physical Source Lines of Code (SLOC) = 6752 Hits@level = [0] 24 [1] 9 [2] 46 [3] 0 [4] 2 [5] 0 Hits@level+ = [0+] 81 [1+] 57 [2+] 48 [3+] 2 [4+] 2 [5+] 0 Hits/KSLOC@level+ = [0+] 11.9964 [1+] 8.44194 [2+] 7.109 [3+] 0.296209 [4+] 0.296209 [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.