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/dnsdbq-2.3.0/defs.h Examining data/dnsdbq-2.3.0/dnsdbq.c Examining data/dnsdbq-2.3.0/globals.h Examining data/dnsdbq-2.3.0/netio.c Examining data/dnsdbq-2.3.0/netio.h Examining data/dnsdbq-2.3.0/ns_ttl.c Examining data/dnsdbq-2.3.0/ns_ttl.h Examining data/dnsdbq-2.3.0/pdns.c Examining data/dnsdbq-2.3.0/pdns.h Examining data/dnsdbq-2.3.0/pdns_circl.c Examining data/dnsdbq-2.3.0/pdns_circl.h Examining data/dnsdbq-2.3.0/pdns_dnsdb.c Examining data/dnsdbq-2.3.0/pdns_dnsdb.h Examining data/dnsdbq-2.3.0/sort.c Examining data/dnsdbq-2.3.0/sort.h Examining data/dnsdbq-2.3.0/time.c Examining data/dnsdbq-2.3.0/time.h FINAL RESULTS: data/dnsdbq-2.3.0/dnsdbq.c:582:2: [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(stderr, fmtstr, ap); data/dnsdbq-2.3.0/dnsdbq.c:798:2: [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(stderr, fmtstr, ap); data/dnsdbq-2.3.0/dnsdbq.c:931:7: [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(cf, R_OK) == 0) { data/dnsdbq-2.3.0/dnsdbq.c:966:7: [4] (shell) popen: This causes a new program to execute and is difficult to use safely (CWE-78). try using a library call that implements the same functionality if available. f = popen(cmd, "r"); data/dnsdbq-2.3.0/ns_ttl.c:146:2: [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, tmp); data/dnsdbq-2.3.0/dnsdbq.c:132:10: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. value = getenv(env_time_fmt); data/dnsdbq-2.3.0/dnsdbq.c:138:15: [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 ((ch = getopt(argc, argv, data/dnsdbq-2.3.0/dnsdbq.c:1203:16: [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 ((ch = getopt(optc, optv, QPARAM_GETOPT)) != -1) { data/dnsdbq-2.3.0/pdns_dnsdb.c:142:15: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((value = getenv(env_api_key)) != NULL) { data/dnsdbq-2.3.0/pdns_dnsdb.c:146:15: [3] (buffer) getenv: Environment variables are untrustable input if they can be set by an attacker. They can have any content and length, and the same variable can be set more than once (CWE-807, CWE-20). Check environment variables carefully before using them. if ((value = getenv(env_dnsdb_base_url)) != NULL) { data/dnsdbq-2.3.0/dnsdbq.c:347:15: [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). json_fd = open(optarg, O_RDONLY); data/dnsdbq-2.3.0/netio.c:282: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(fetch->buf + fetch->len, ptr, bytes); data/dnsdbq-2.3.0/ns_ttl.c:140: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 tmp[50]; data/dnsdbq-2.3.0/ns_ttl.c:143:17: [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. len = (size_t) sprintf(tmp, "%lu%c", t, s); data/dnsdbq-2.3.0/pdns.c:43: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 duration[50]; data/dnsdbq-2.3.0/pdns.c:56: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 duration[50]; data/dnsdbq-2.3.0/sort.c:117: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 *sort_argv[3+MAX_KEYS], **sap; data/dnsdbq-2.3.0/time.c:47: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 ret[sizeof "yyyy-mm-ddThh:mm:ssZ"]; data/dnsdbq-2.3.0/dnsdbq.c:1130: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). writer->ps_len = strlen(writer->ps_buf); data/dnsdbq-2.3.0/dnsdbq.c:1158:23: [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). char **optv = calloc(strlen(optstr) + 1, sizeof(char *)); data/dnsdbq-2.3.0/dnsdbq.c:1465:16: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read(json_fd, buf, sizeof buf)) > 0) { data/dnsdbq-2.3.0/netio.c:745:46: [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). escaped = curl_easy_escape(easy, *str, (int)strlen(*str)); data/dnsdbq-2.3.0/pdns.c:47:4: [1] (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 character. strcpy(duration, "?"); data/dnsdbq-2.3.0/pdns.c:60:4: [1] (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 character. strcpy(duration, "?"); data/dnsdbq-2.3.0/pdns_circl.c:108: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). if (strncasecmp(path, valid_paths[pi], strlen(valid_paths[pi])) data/dnsdbq-2.3.0/pdns_circl.c:111: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). val = path + strlen(valid_paths[pi]); data/dnsdbq-2.3.0/sort.c:223:6: [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(rdatum)); data/dnsdbq-2.3.0/sort.c:225: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). sortable_hexify(buf, (const u_char *)rdatum, strlen(rdatum)); data/dnsdbq-2.3.0/time.c:50:3: [1] (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 character. strcpy(ret, "0"); ANALYSIS SUMMARY: Hits = 29 Lines analyzed = 4627 in approximately 0.14 seconds (32356 lines/second) Physical Source Lines of Code (SLOC) = 3413 Hits@level = [0] 86 [1] 11 [2] 8 [3] 5 [4] 5 [5] 0 Hits@level+ = [0+] 115 [1+] 29 [2+] 18 [3+] 10 [4+] 5 [5+] 0 Hits/KSLOC@level+ = [0+] 33.6947 [1+] 8.49692 [2+] 5.27395 [3+] 2.92997 [4+] 1.46499 [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.