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/pyasn-1.6.1/pyasn/_radix/radix.c Examining data/pyasn-1.6.1/pyasn/_radix/radix.h Examining data/pyasn-1.6.1/pyasn/pyasn_radix.c FINAL RESULTS: data/pyasn-1.6.1/pyasn/_radix/radix.h:67:9: [4] (format) snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define snprintf _snprintf data/pyasn-1.6.1/pyasn/_radix/radix.h:67:18: [4] (format) _snprintf: If format strings can be influenced by an attacker, they can be exploited, and note that sprintf variations do not always \0-terminate (CWE-134). Use a constant for the format specification. #define snprintf _snprintf data/pyasn-1.6.1/pyasn/pyasn_radix.c:118:5: [4] (buffer) sprintf: Does not check for buffer overflows (CWE-120). Use sprintf_s, snprintf, or vsnprintf. sprintf(buf, "%s/%d", addr, rn->prefix->bitlen); data/pyasn-1.6.1/pyasn/_radix/radix.c:118:17: [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(&prefix->add.sin6, dest, 16); data/pyasn-1.6.1/pyasn/_radix/radix.c:126:17: [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(&prefix->add.sin, dest, 4); data/pyasn-1.6.1/pyasn/_radix/radix.c:565: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. unsigned char buf[sizeof(struct in6_addr)]; data/pyasn-1.6.1/pyasn/pyasn_radix.c:113: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 addr[INET6_ADDRSTRLEN], buf[128]; data/pyasn-1.6.1/pyasn/pyasn_radix.c:583:5: [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(&prefix->add.sin, addr, 4); data/pyasn-1.6.1/pyasn/pyasn_radix.c:636: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 err_msg[512]; data/pyasn-1.6.1/pyasn/pyasn_radix.c:656: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[512], *p1, *p2; data/pyasn-1.6.1/pyasn/pyasn_radix.c:658: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 ((ccfd = fopen(from_file, "rt" )) == NULL) { data/pyasn-1.6.1/pyasn/pyasn_radix.c:673:51: [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). if (!add_pyobject_to_radix_tree(self, atol(p1), atoi(p2), buf)) data/pyasn-1.6.1/pyasn/pyasn_radix.c:673:61: [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). if (!add_pyobject_to_radix_tree(self, atol(p1), atoi(p2), buf)) data/pyasn-1.6.1/pyasn/pyasn_radix.c:684: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. char buf[512], *p1, *p2; data/pyasn-1.6.1/pyasn/pyasn_radix.c:706:51: [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). if (!add_pyobject_to_radix_tree(self, atol(p1), atoi(p2), buf)) data/pyasn-1.6.1/pyasn/pyasn_radix.c:706:61: [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). if (!add_pyobject_to_radix_tree(self, atol(p1), atoi(p2), buf)) data/pyasn-1.6.1/pyasn/pyasn_radix.c:717:5: [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(err_msg, "Error while parsing/adding IPASN database (record: %d)!", (int)(record+1)); ANALYSIS SUMMARY: Hits = 17 Lines analyzed = 1885 in approximately 0.09 seconds (21642 lines/second) Physical Source Lines of Code (SLOC) = 1318 Hits@level = [0] 1 [1] 0 [2] 14 [3] 0 [4] 3 [5] 0 Hits@level+ = [0+] 18 [1+] 17 [2+] 17 [3+] 3 [4+] 3 [5+] 0 Hits/KSLOC@level+ = [0+] 13.6571 [1+] 12.8983 [2+] 12.8983 [3+] 2.27618 [4+] 2.27618 [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.