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/libmaxmind-db-writer-perl-0.300003/c/tree.h Examining data/libmaxmind-db-writer-perl-0.300003/c/uthash.h Examining data/libmaxmind-db-writer-perl-0.300003/c/ppport.h Examining data/libmaxmind-db-writer-perl-0.300003/c/windows_mman.c Examining data/libmaxmind-db-writer-perl-0.300003/c/windows_mman.h Examining data/libmaxmind-db-writer-perl-0.300003/c/perl_math_int64.c Examining data/libmaxmind-db-writer-perl-0.300003/c/perl_math_int64.h Examining data/libmaxmind-db-writer-perl-0.300003/c/perl_math_int128.c Examining data/libmaxmind-db-writer-perl-0.300003/c/perl_math_int128.h Examining data/libmaxmind-db-writer-perl-0.300003/c/tree.c FINAL RESULTS: data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7585:14: [4] (format) vsnprintf: 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. retval = vsnprintf(buffer, len, format, ap); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7587:14: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. retval = vsprintf(buffer, format, ap); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7617:5: [4] (format) vsprintf: Potential format string problem (CWE-134). Make format string constant. vsprintf(buffer, pat, args); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:468:9: [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((char *)data->key, key); data/libmaxmind-db-writer-perl-0.300003/c/uthash.h:286:29: [4] (format) fprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. #define HASH_OOPS(...) do { fprintf(stderr,__VA_ARGS__); exit(-1); } while (0) data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:3920:42: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. # define CopyD(s,d,n,t) memcpy((char*)(d),(char*)(s), (n) * sizeof(t)) data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7438:38: [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. && (xdigit = strchr((char *) PL_hexdigit, s[1]))) data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7664:9: [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 + used, src, copy); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7694:9: [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, src, copy); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7787: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 octbuf[32] = "%123456789ABCDF"; data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7857:13: [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 tmp[2]; data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1043: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 merge_cache_key[MERGE_KEY_SIZE + 1]; data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1104: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 address_string[is_ipv6 ? INET6_ADDRSTRLEN : INET_ADDRSTRLEN]; data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1420:18: [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). FILE *file = fopen(filename, "wb"); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1572:14: [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(filename, O_RDONLY); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1574:14: [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(filename, O_RDONLY, 0); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1640: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(&value, *buffer, 1); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1675:9: [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(bytes, start_ip_bytes + 12, 4); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1678:9: [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(bytes, &start_ip, 16); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1687: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(thawed->network, &network, sizeof(MMDBW_network_s)); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1701: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(value, *buffer, size); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1708: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(&value, *buffer, 16); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1715: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(&value, *buffer, sizeof(STRLEN)); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1722: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(value, *buffer, SHA1_KEY_LENGTH); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1999: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 ip[INET6_ADDRSTRLEN]; data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:5964: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). sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:5972:59: [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). # define sv_vcatpvf(sv, pat, args) sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:5976:59: [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). # define sv_vsetpvf(sv, pat, args) sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)) data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:5997: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). sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:6026: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). sv_vcatpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:6047:27: [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). sv_vcatpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:6070: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). sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:6099: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). sv_vsetpvfn(sv, pat, strlen(pat), &args, Null(SV**), 0, Null(bool*)); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:6120:27: [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). sv_vsetpvfn(sv, pat, strlen(pat), args, Null(SV**), 0, Null(bool*)); \ data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:6175:65: [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). # define HvNAMELEN_get(hv) (HvNAME_get(hv) ? (I32)strlen(HvNAME_get(hv)) : 0) data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7029:22: [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). STRLEN len = strlen(radix); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7619: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). return strlen(buffer); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7660: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). used = strlen(dst); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7661:14: [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). length = strlen(src); data/libmaxmind-db-writer-perl-0.300003/c/ppport.h:7691:14: [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). length = strlen(src); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:1918: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). mPUSHp(record->value.key, strlen(record->value.key)); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:2073:42: [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). HASH_FIND(hh, tree->data_table, key, strlen(key), data); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:2109:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char *)data->value, new_key, SHA1_KEY_LENGTH + 1); data/libmaxmind-db-writer-perl-0.300003/c/tree.c:2112:5: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy((char *)data->key, merge_cache_key, MERGE_KEY_SIZE + 1); data/libmaxmind-db-writer-perl-0.300003/c/uthash.h:262:41: [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). HASH_FIND(hh,head,findstr,(unsigned)strlen(findstr),out) data/libmaxmind-db-writer-perl-0.300003/c/uthash.h:264:34: [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). HASH_ADD(hh,head,strfield[0],strlen(add->strfield),add) data/libmaxmind-db-writer-perl-0.300003/c/uthash.h:266:48: [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). HASH_REPLACE(hh,head,strfield[0],(unsigned)strlen(add->strfield),add,replaced) ANALYSIS SUMMARY: Hits = 47 Lines analyzed = 11958 in approximately 0.32 seconds (37765 lines/second) Physical Source Lines of Code (SLOC) = 6675 Hits@level = [0] 1 [1] 22 [2] 20 [3] 0 [4] 5 [5] 0 Hits@level+ = [0+] 48 [1+] 47 [2+] 25 [3+] 5 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 7.19101 [1+] 7.0412 [2+] 3.74532 [3+] 0.749064 [4+] 0.749064 [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.