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/dns2tcp-0.5.2/common/includes/myrand.h Examining data/dns2tcp-0.5.2/common/includes/memdump.h Examining data/dns2tcp-0.5.2/common/includes/base64.h Examining data/dns2tcp-0.5.2/common/includes/mycrypto.h Examining data/dns2tcp-0.5.2/common/includes/dns.h Examining data/dns2tcp-0.5.2/common/includes/mywin32.h Examining data/dns2tcp-0.5.2/common/includes/crc16.h Examining data/dns2tcp-0.5.2/common/includes/myerror.h Examining data/dns2tcp-0.5.2/common/includes/packet.h Examining data/dns2tcp-0.5.2/common/includes/mystrnlen.h Examining data/dns2tcp-0.5.2/common/includes/my_config.h Examining data/dns2tcp-0.5.2/common/includes/hmac_sha1.h Examining data/dns2tcp-0.5.2/common/includes/list.h Examining data/dns2tcp-0.5.2/common/includes/debug.h Examining data/dns2tcp-0.5.2/common/crc16.c Examining data/dns2tcp-0.5.2/common/memdump.c Examining data/dns2tcp-0.5.2/common/list.c Examining data/dns2tcp-0.5.2/common/getopt.c Examining data/dns2tcp-0.5.2/common/hmac_sha1.c Examining data/dns2tcp-0.5.2/common/base64.c Examining data/dns2tcp-0.5.2/common/mycrypto.c Examining data/dns2tcp-0.5.2/common/mystrnlen.c Examining data/dns2tcp-0.5.2/common/dns.c Examining data/dns2tcp-0.5.2/common/myrand.c Examining data/dns2tcp-0.5.2/common/config.c Examining data/dns2tcp-0.5.2/client/includes/rr.h Examining data/dns2tcp-0.5.2/client/includes/socket.h Examining data/dns2tcp-0.5.2/client/includes/options.h Examining data/dns2tcp-0.5.2/client/includes/session.h Examining data/dns2tcp-0.5.2/client/includes/auth.h Examining data/dns2tcp-0.5.2/client/includes/requests.h Examining data/dns2tcp-0.5.2/client/includes/queue.h Examining data/dns2tcp-0.5.2/client/includes/command.h Examining data/dns2tcp-0.5.2/client/includes/client.h Examining data/dns2tcp-0.5.2/client/includes/control.h Examining data/dns2tcp-0.5.2/client/includes/select.h Examining data/dns2tcp-0.5.2/client/socket.c Examining data/dns2tcp-0.5.2/client/requests.c Parsing failed to find end of parameter list; semicolon terminated it in (stderr, "send_query : data too long (%d bytes -> %zd bytes)\n", #else fprintf(stderr, "send_query : data too long (%d bytes -> %d bytes)\n", #endif req->len, ENCODED_LEN(BASE64_SIZE(re Examining data/dns2tcp-0.5.2/client/auth.c Examining data/dns2tcp-0.5.2/client/rr.c Examining data/dns2tcp-0.5.2/client/client.c Examining data/dns2tcp-0.5.2/client/session.c Examining data/dns2tcp-0.5.2/client/command.c Examining data/dns2tcp-0.5.2/client/select.c Examining data/dns2tcp-0.5.2/client/main.c Examining data/dns2tcp-0.5.2/client/queue.c Examining data/dns2tcp-0.5.2/client/options.c Examining data/dns2tcp-0.5.2/server/dns_decode.c Examining data/dns2tcp-0.5.2/server/server.c Examining data/dns2tcp-0.5.2/server/includes/rr.h Examining data/dns2tcp-0.5.2/server/includes/socket.h Examining data/dns2tcp-0.5.2/server/includes/options.h Examining data/dns2tcp-0.5.2/server/includes/session.h Examining data/dns2tcp-0.5.2/server/includes/auth.h Examining data/dns2tcp-0.5.2/server/includes/requests.h Examining data/dns2tcp-0.5.2/server/includes/queue.h Examining data/dns2tcp-0.5.2/server/includes/server.h Examining data/dns2tcp-0.5.2/server/includes/log.h Examining data/dns2tcp-0.5.2/server/includes/control.h Examining data/dns2tcp-0.5.2/server/includes/dns_decode.h Examining data/dns2tcp-0.5.2/server/includes/trace.h Examining data/dns2tcp-0.5.2/server/socket.c Examining data/dns2tcp-0.5.2/server/auth.c Examining data/dns2tcp-0.5.2/server/rr.c Examining data/dns2tcp-0.5.2/server/session.c Examining data/dns2tcp-0.5.2/server/queue.c Examining data/dns2tcp-0.5.2/server/main.c Examining data/dns2tcp-0.5.2/server/requests.c Examining data/dns2tcp-0.5.2/server/options.c FINAL RESULTS: data/dns2tcp-0.5.2/client/command.c:119:7: [4] (shell) execv: 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. execv(argv[0],argv); data/dns2tcp-0.5.2/client/requests.c:76:3: [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(where , name); data/dns2tcp-0.5.2/client/requests.c:93:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(output, req->domain); data/dns2tcp-0.5.2/client/requests.c:243:3: [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(request->domain, subdomain); data/dns2tcp-0.5.2/client/requests.c:244:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(request->domain, conf->domain); data/dns2tcp-0.5.2/client/session.c:104:3: [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(domain, AUTH); data/dns2tcp-0.5.2/client/session.c:105:3: [4] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). strcat(domain, conf->domain); data/dns2tcp-0.5.2/common/includes/debug.h:46:12: [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. fprintf(stderr, fmt, ##args); \ data/dns2tcp-0.5.2/common/includes/debug.h:55:7: [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. fprintf(stderr, fmt, ##args); \ data/dns2tcp-0.5.2/common/includes/myerror.h:29:2: [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. fprintf(stderr, fmt, ##args); \ data/dns2tcp-0.5.2/server/dns_decode.c:88:3: [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(req->domain, ptr); data/dns2tcp-0.5.2/server/includes/log.h:32:13: [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. fprintf(stderr, fmt, ##args); \ data/dns2tcp-0.5.2/server/includes/log.h:35:10: [4] (format) syslog: If syslog's format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant format string for syslog. syslog(LOG_LEVEL, fmt, ##args); \ data/dns2tcp-0.5.2/server/requests.c:118:4: [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(&buffer2[PACKET_LEN], list->data); data/dns2tcp-0.5.2/server/requests.c:238:3: [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(buffer + sizeof(t_packet), str); data/dns2tcp-0.5.2/server/rr.c:84:7: [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(JUMP_RR_HDR(rr)+1, encoded_data); data/dns2tcp-0.5.2/client/command.c:225:9: [3] (shell) CreateProcess: This causes a new process to execute and is difficult to use safely (CWE-78). Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to run. res = CreateProcess(NULL, conf->cmdline, NULL, NULL, TRUE, 0, data/dns2tcp-0.5.2/client/command.c:225:9: [3] (shell) CreateProcess: This causes a new process to execute and is difficult to use safely (CWE-78). Specify the application path in the first argument, NOT as part of the second, or embedded spaces could allow an attacker to force a different program to run. res = CreateProcess(NULL, conf->cmdline, NULL, NULL, TRUE, 0, data/dns2tcp-0.5.2/client/main.c:54:3: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(getpid() ^ (unsigned int) time(0)); data/dns2tcp-0.5.2/client/options.c:39:6: [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. int getopt(int, char * const *, const char *); data/dns2tcp-0.5.2/client/options.c:249:11: [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. c = getopt (argc, argv, "ch:z:T:t:s:d:l:r:f:e:o:k:"); data/dns2tcp-0.5.2/common/config.c:149:21: [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 ((!(home = getenv("HOME"))) data/dns2tcp-0.5.2/common/getopt.c:15:5: [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. int getopt(int argc, char **argv, char *opts) data/dns2tcp-0.5.2/server/includes/server.h:49:11: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. char *chroot; data/dns2tcp-0.5.2/server/main.c:132:13: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if (conf->chroot) data/dns2tcp-0.5.2/server/main.c:134:42: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. DPRINTF(1, "Chroot to %s\n", conf->chroot); data/dns2tcp-0.5.2/server/main.c:136:12: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if ((chroot(conf->chroot) == -1) || chdir("/")) data/dns2tcp-0.5.2/server/main.c:136:25: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. if ((chroot(conf->chroot) == -1) || chdir("/")) data/dns2tcp-0.5.2/server/main.c:138:42: [3] (misc) chroot: chroot can be very helpful, but is hard to use correctly (CWE-250, CWE-22). Make sure the program immediately chdir("/"), closes file descriptors, and drops root privileges, and that all necessary files (and no more!) are in the new root. LOG("Failed to chroot in %s\n", conf->chroot); data/dns2tcp-0.5.2/server/main.c:177:7: [3] (random) srand: This function is not sufficiently random for security-related functions such as key and nonce creation (CWE-327). Use a more secure technique for acquiring random values. srand(getpid()^time(0)); data/dns2tcp-0.5.2/server/options.c:175:11: [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. c = getopt (argc, argv, "hFf:i:d:p:"); data/dns2tcp-0.5.2/client/auth.c:46: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 domain[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/client/auth.c:47: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 buffer[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/client/auth.c:84: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 domain[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/client/auth.c:86: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 buffer[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/client/client.c:291: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 buffer[MAX_EDNS_LEN+1]; data/dns2tcp-0.5.2/client/client.c:343:8: [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(conf->output_file,O_CREAT|O_WRONLY|O_TRUNC, 0700); data/dns2tcp-0.5.2/client/command.c:103:7: [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 *argv[MAX_ARG_SIZE]; data/dns2tcp-0.5.2/client/command.c:147: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[128]; data/dns2tcp-0.5.2/client/command.c:149: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(name, "\\\\.\\pipe\\win-sux-no-async-anon-pipe-%lu-%i", data/dns2tcp-0.5.2/client/includes/requests.h:26: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 data[MAX_EDNS_LEN]; data/dns2tcp-0.5.2/client/options.c:127:58: [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). return ((conf->local_port)? 0 : (conf->local_port = atoi(value))); data/dns2tcp-0.5.2/client/options.c:131:74: [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). return ((conf->disable_compression) ? 0 : (conf->disable_compression = !atoi(value))); data/dns2tcp-0.5.2/client/options.c:133:31: [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). return (debug ? 0 : (debug = atoi(value))); data/dns2tcp-0.5.2/client/options.c:135:42: [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). return (conf->query_size ? 0 : (debug = atoi(value))); data/dns2tcp-0.5.2/client/options.c:171: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 buffer[MAX_LINE_LEN+1]; data/dns2tcp-0.5.2/client/options.c:173: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). if (!(resolv = fopen(RESOLV_CONF, "r"))) data/dns2tcp-0.5.2/client/options.c:238: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 config_file[CONFIG_FILE_LEN]; data/dns2tcp-0.5.2/client/options.c:262:10: [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). debug = atoi(optarg); data/dns2tcp-0.5.2/client/options.c:274:21: [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). conf->query_size = atoi(optarg); data/dns2tcp-0.5.2/client/options.c:285:23: [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). conf->local_port = atoi(optarg); data/dns2tcp-0.5.2/client/options.c:298:6: [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). c = atoi(optarg); data/dns2tcp-0.5.2/client/queue.c:304: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 buffer[MAX_DNS_LEN + 1 - DNS_HDR_SIZE - RR_HDR_SIZE]; data/dns2tcp-0.5.2/client/queue.c:314: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(req.req_data, queue->data, queue->len); data/dns2tcp-0.5.2/client/queue.c:527:8: [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(queue->data, buffer, len); data/dns2tcp-0.5.2/client/requests.c:130: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[MAX_HOST_NAME_ENCODED + 1]; data/dns2tcp-0.5.2/client/requests.c:162: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 buffer[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/client/rr.c:95: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 buffer[MAX_EDNS_LEN - DNS_HDR_SIZE - RR_HDR_SIZE]; data/dns2tcp-0.5.2/client/rr.c:114: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 buffer[MAX_EDNS_LEN - DNS_HDR_SIZE - RR_HDR_SIZE]; data/dns2tcp-0.5.2/client/session.c:70: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 buffer[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/client/session.c:95: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 domain[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/client/session.c:99: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 challenge[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/common/base64.c:36:23: [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 const unsigned char pr2six[256] = data/dns2tcp-0.5.2/common/config.c:107: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 buffer[MAX_LINE_LEN + 1]; data/dns2tcp-0.5.2/common/config.c:108: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 token[MAX_LINE_LEN + 1]; data/dns2tcp-0.5.2/common/config.c:154:19: [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 (!(my_file = fopen(file, "r"))) data/dns2tcp-0.5.2/common/dns.c:31:7: [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. const char *dns_error[MAX_DNS_ERROR] = { data/dns2tcp-0.5.2/common/dns.c:185: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 buffer2[MAX_EDNS_LEN]; data/dns2tcp-0.5.2/common/hmac_sha1.c:89:61: [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 void sha1_process( sha1_context *ctx, const unsigned char data[64] ) data/dns2tcp-0.5.2/common/hmac_sha1.c:267: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( (void *) (ctx->buffer + left), data/dns2tcp-0.5.2/common/hmac_sha1.c:284: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( (void *) (ctx->buffer + left), data/dns2tcp-0.5.2/common/hmac_sha1.c:289:23: [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 const unsigned char sha1_padding[64] = data/dns2tcp-0.5.2/common/hmac_sha1.c:300:47: [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. void sha1_finish( sha1_context *ctx, unsigned char output[20] ) data/dns2tcp-0.5.2/common/hmac_sha1.c:304:14: [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 msglen[8]; data/dns2tcp-0.5.2/common/hmac_sha1.c:329:27: [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. void sha1( const unsigned char *input, int ilen, unsigned char output[20] ) data/dns2tcp-0.5.2/common/hmac_sha1.c:329:59: [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. void sha1( const unsigned char *input, int ilen, unsigned char output[20] ) data/dns2tcp-0.5.2/common/hmac_sha1.c:346:14: [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 sum[20]; data/dns2tcp-0.5.2/common/hmac_sha1.c:381:52: [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. void sha1_hmac_finish( sha1_context *ctx, unsigned char output[20] ) data/dns2tcp-0.5.2/common/hmac_sha1.c:383:14: [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 tmpbuf[20]; data/dns2tcp-0.5.2/common/hmac_sha1.c:406:32: [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. void sha1_hmac( const unsigned char *key, int keylen, data/dns2tcp-0.5.2/common/hmac_sha1.c:407:32: [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. const unsigned char *input, int ilen, data/dns2tcp-0.5.2/common/hmac_sha1.c:408:26: [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 output[20] ) data/dns2tcp-0.5.2/common/includes/debug.h:38:10: [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 my_time[64]; \ data/dns2tcp-0.5.2/common/includes/dns.h:105:14: [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 *)(dst))[0] = (uint8_t) ((src ) >> 8) ; \ data/dns2tcp-0.5.2/common/includes/dns.h:106:14: [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 *)(dst))[1] = (uint8_t) (src) ; \ data/dns2tcp-0.5.2/common/includes/dns.h:111:15: [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 *)(dst))[0] = (uint8_t) ((src ) >> 24) ; \ data/dns2tcp-0.5.2/common/includes/dns.h:112:15: [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 *)(dst))[1] = (uint8_t) ((src ) >> 16) ; \ data/dns2tcp-0.5.2/common/includes/dns.h:113:15: [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 *)(dst))[2] = (uint8_t) ((src ) >> 8) ; \ data/dns2tcp-0.5.2/common/includes/dns.h:114:15: [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 *)(dst))[3] = (uint8_t) (src) ; \ data/dns2tcp-0.5.2/common/includes/dns.h:118:34: [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. #define GET_16(src) ((((unsigned char *)(src))[0] << 8) | (((unsigned char *)(src))[1]) ) data/dns2tcp-0.5.2/common/includes/dns.h:118:71: [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. #define GET_16(src) ((((unsigned char *)(src))[0] << 8) | (((unsigned char *)(src))[1]) ) data/dns2tcp-0.5.2/common/includes/dns.h:120: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 *)(src))[0] << 24) | \ data/dns2tcp-0.5.2/common/includes/dns.h:121: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 *)(src))[1] << 16) | \ data/dns2tcp-0.5.2/common/includes/dns.h:122: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 *)(src))[2] << 8) | \ data/dns2tcp-0.5.2/common/includes/dns.h:123: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 *)(src))[3] ) \ data/dns2tcp-0.5.2/common/includes/dns.h:168:14: [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. extern const char *dns_error[MAX_DNS_ERROR]; data/dns2tcp-0.5.2/common/includes/hmac_sha1.h:49:14: [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 buffer[64]; /*!< data block being processed */ data/dns2tcp-0.5.2/common/includes/hmac_sha1.h:51:14: [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 ipad[64]; /*!< HMAC: inner padding */ data/dns2tcp-0.5.2/common/includes/hmac_sha1.h:52:14: [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 opad[64]; /*!< HMAC: outer padding */ data/dns2tcp-0.5.2/common/includes/hmac_sha1.h:56:32: [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. void sha1_hmac( const unsigned char *key, int keylen, data/dns2tcp-0.5.2/common/includes/hmac_sha1.h:57:32: [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. const unsigned char *input, int ilen, data/dns2tcp-0.5.2/common/includes/hmac_sha1.h:58:26: [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 output[20] ); data/dns2tcp-0.5.2/common/includes/list.h:50: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 data[MAX_EDNS_LEN + 1]; data/dns2tcp-0.5.2/common/memdump.c:29: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 buffer[4*LINE_LEN+2]; data/dns2tcp-0.5.2/common/memdump.c:37: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(&buffer[3*(idx%LINE_LEN)], "%.2X ", (*(memory+idx)) & 0xff ); data/dns2tcp-0.5.2/common/mycrypto.c:49: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 sha1sum[SHA1_SIZE+1]; data/dns2tcp-0.5.2/common/mycrypto.c:63:2: [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(output + 2*i, "%.2X", sha1sum[i]&0xff); data/dns2tcp-0.5.2/server/auth.c:139: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 buffer[SHA1_SIZE*2+1]; data/dns2tcp-0.5.2/server/includes/control.h:36: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 challenge[CHALLENGE_SIZE+1]; data/dns2tcp-0.5.2/server/includes/control.h:42: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 data[MAX_HOST_NAME_ENCODED]; data/dns2tcp-0.5.2/server/main.c:60:17: [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("/dev/null", O_RDWR)) == -1) data/dns2tcp-0.5.2/server/main.c:68:20: [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 (! (pidfile = fopen((conf->pidfile == 0)? DEFAULT_PIDFILE: conf->pidfile, "w"))) data/dns2tcp-0.5.2/server/main.c:120: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). pid_file = fopen(conf->pid_file, "w"); data/dns2tcp-0.5.2/server/options.c:96:21: [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). cell->info.port = atoi(port); data/dns2tcp-0.5.2/server/options.c:121:31: [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). return (debug ? 0 : (debug = atoi(value))); data/dns2tcp-0.5.2/server/options.c:123:23: [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). return (conf->port = atoi(value)); data/dns2tcp-0.5.2/server/options.c:168: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 config_file[CONFIG_FILE_LEN]; data/dns2tcp-0.5.2/server/options.c:185:10: [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). debug = atoi(optarg); data/dns2tcp-0.5.2/server/queue.c:133:7: [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(queue->peer.data, data, len - PACKET_LEN); data/dns2tcp-0.5.2/server/queue.c:186: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 buffer[MAX_EDNS_LEN - DNS_HDR_SIZE - REQ_HDR_SIZE ]; data/dns2tcp-0.5.2/server/queue.c:195: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(&req.sa, &(queue->peer.sa), sizeof(struct sockaddr_in)); data/dns2tcp-0.5.2/server/queue.c:207:7: [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((char *)(output_data.buffer)+PACKET_LEN, data, data_len); data/dns2tcp-0.5.2/server/queue.c:438: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 buffer[ MAX_EDNS_LEN ]; data/dns2tcp-0.5.2/server/queue.c:520:7: [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(queue->data, req->data, req->len); data/dns2tcp-0.5.2/server/queue.c:522:7: [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(&(queue->peer.sa), &req->sa, sizeof(struct sockaddr_in)); data/dns2tcp-0.5.2/server/queue.c:538:7: [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(queue->data, req->data, sizeof(uint16_t)); data/dns2tcp-0.5.2/server/queue.c:541:7: [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(&(queue->peer.sa), &req->sa, sizeof(struct sockaddr_in)); data/dns2tcp-0.5.2/server/requests.c:91: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 buffer2[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/server/requests.c:92: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 buffer[MAX_DNS_LEN + 1]; data/dns2tcp-0.5.2/server/requests.c:144: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 buffer[MAX_HOST_NAME_ENCODED + 1]; data/dns2tcp-0.5.2/server/requests.c:184: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 buffer[MAX_EDNS_LEN]; data/dns2tcp-0.5.2/server/requests.c:226: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 buffer[MAX_EDNS_LEN]; data/dns2tcp-0.5.2/server/requests.c:237: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(buffer, packet, sizeof(t_packet)); data/dns2tcp-0.5.2/server/requests.c:252:4: [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 recv_buffer[MAX_EDNS_LEN + 1]; data/dns2tcp-0.5.2/server/requests.c:253:4: [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 domain[MAX_HOST_NAME_ENCODED]; data/dns2tcp-0.5.2/server/requests.c:254:4: [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 input[MAX_HOST_NAME_ENCODED + 1]; data/dns2tcp-0.5.2/server/rr.c:89:7: [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(JUMP_RR_HDR(rr), "AAAA"); data/dns2tcp-0.5.2/server/rr.c:101: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 domain[MAX_EDNS_LEN]; data/dns2tcp-0.5.2/server/rr.c:115: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 *)where)[len] = COMPRESS_FLAG_CHAR; /* add domain name */ data/dns2tcp-0.5.2/server/rr.c:116: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 *)where)[len+1] = (uint16_t) (my_domain - (char *)hdr); data/dns2tcp-0.5.2/server/server.c:152: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 buffer[MINI_BUFF]; data/dns2tcp-0.5.2/server/socket.c:68:11: [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(&su.in.sin_addr, data/dns2tcp-0.5.2/client/auth.c:95:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(resource, conf->resource, sizeof(request.req_data) - PACKET_LEN - 1); data/dns2tcp-0.5.2/client/auth.c:96:30: [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). request.len = PACKET_LEN + strlen(conf->resource); data/dns2tcp-0.5.2/client/client.c:200:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while ((len = read(conf->sd_udp, buffer, MAX_DNS_LEN)) > 0) data/dns2tcp-0.5.2/client/client.c:301:7: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(0, buffer, MINI_BUFF); data/dns2tcp-0.5.2/client/options.c:213:7: [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 (strlen(pfi->DnsServerList.IpAddress.String) > 0) data/dns2tcp-0.5.2/client/options.c:254: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). if (strlen(optarg) > (CONFIG_FILE_LEN - 10)) data/dns2tcp-0.5.2/client/options.c:256:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(config_file, optarg, CONFIG_FILE_LEN-1); data/dns2tcp-0.5.2/client/queue.c:600:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(client->fd_ro, &req->req_data[PACKET_LEN], max_len)) <= 0) data/dns2tcp-0.5.2/client/queue.c:651:17: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). req.len = read(client->fd_ro, &req.req_data[PACKET_LEN], max_len); data/dns2tcp-0.5.2/client/requests.c:71:15: [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). query_len = strlen(name) + 1; data/dns2tcp-0.5.2/client/requests.c:92:3: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(output, "."); data/dns2tcp-0.5.2/client/requests.c:95:55: [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). DPRINTF(3, "Query is %s len %zd\n", (char *)output, strlen(output)); data/dns2tcp-0.5.2/client/requests.c:97:54: [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). DPRINTF(3, "Query is %s len %d\n", (char *)output, strlen(output)); data/dns2tcp-0.5.2/client/requests.c:136:45: [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 ((ENCODED_LEN(BASE64_SIZE(req->len)) + strlen(req->domain) + 2 ) > (MAX_HOST_NAME_ENCODED)) data/dns2tcp-0.5.2/client/requests.c:143:55: [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). req->len, ENCODED_LEN(BASE64_SIZE(req->len)) + strlen(req->domain) + 2 ); data/dns2tcp-0.5.2/client/requests.c:240: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). if ((strlen(conf->domain) + strlen(subdomain)) > MAX_DNS_LEN) data/dns2tcp-0.5.2/client/requests.c:240:31: [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 ((strlen(conf->domain) + strlen(subdomain)) > MAX_DNS_LEN) data/dns2tcp-0.5.2/client/rr.c:100: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). if (ENCODED_LEN(DECODED_BASE64_SIZE(strlen(JUMP_RR_HDR(reply)))) > max_len) data/dns2tcp-0.5.2/client/rr.c:119:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, JUMP_RR_HDR(reply), GET_16(&(reply->rdlength))); data/dns2tcp-0.5.2/client/rr.c:121: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). if (DECODED_BASE64_SIZE(strlen(buffer)) > max_len) data/dns2tcp-0.5.2/client/session.c:101: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). if ((strlen(conf->domain) + sizeof(AUTH)) > MAX_DNS_LEN) data/dns2tcp-0.5.2/client/socket.c:73:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). && ((len = read(conf->sd_udp, buffer, MAX_DNS_LEN)) > 0)) data/dns2tcp-0.5.2/client/socket.c:104:18: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(conf->sd_udp, buffer, MAX_DNS_LEN)) > 0) data/dns2tcp-0.5.2/common/config.c:70: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(buffer); data/dns2tcp-0.5.2/common/config.c:122:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(token, buffer, MAX_LINE_LEN); data/dns2tcp-0.5.2/common/config.c:150: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). || ((strlen(home) > (CONFIG_FILE_LEN - sizeof("/.dns2tcprc") - 10)))) data/dns2tcp-0.5.2/common/dns.c:189:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(buffer, data, MAX_DNS_LEN-1); data/dns2tcp-0.5.2/common/dns.c:197:6: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(data + 1, buffer, len); data/dns2tcp-0.5.2/common/dns.c:205:4: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(data + 1, buffer, len); data/dns2tcp-0.5.2/common/dns.c:240:7: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(output, ptr + 1, len++); data/dns2tcp-0.5.2/common/dns.c:276:7: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(output, ptr + 1, len); data/dns2tcp-0.5.2/common/includes/dns.h:82:78: [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 MAX_QNAME_DATA(domain) (DECODED_BASE64_SIZE(MAX_HOST_NAME_DECODED - strlen(domain) - 1)) data/dns2tcp-0.5.2/common/includes/mywin32.h:39:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). #define read(f,b,l) recv(f, b, (int) l, 0) data/dns2tcp-0.5.2/common/mycrypto.c:55: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). key ? strlen(key) : 0, data/dns2tcp-0.5.2/server/auth.c:58:15: [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 (!(len = strlen(resource))) data/dns2tcp-0.5.2/server/dns_decode.c:50:13: [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). req_len = strlen(output); data/dns2tcp-0.5.2/server/dns_decode.c:51:16: [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). domain_len = strlen(conf->my_domain); data/dns2tcp-0.5.2/server/dns_decode.c:123:7: [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 (strlen(ptr) < (strlen(conf->my_domain) + 1)) data/dns2tcp-0.5.2/server/dns_decode.c:123: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). if (strlen(ptr) < (strlen(conf->my_domain) + 1)) data/dns2tcp-0.5.2/server/dns_decode.c:134:7: [1] (buffer) strncat: Easily used incorrectly (e.g., incorrectly computing the correct maximum size to add) [MS-banned] (CWE-120). Consider strcat_s, strlcat, snprintf, or automatically resizing strings. strncat(output, ptr + 1, len); data/dns2tcp-0.5.2/server/dns_decode.c:140:4: [1] (buffer) strcat: Does not check for buffer overflows when concatenating to destination [MS-banned] (CWE-120). Consider using strcat_s, strncat, strlcat, or snprintf (warning: strncat is easily misused). Risk is low because the source is a constant character. strcat(output , "."); data/dns2tcp-0.5.2/server/options.c:95:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(cell->data, value, MAX_DNS_LEN-1); data/dns2tcp-0.5.2/server/options.c:180: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). if (strlen(optarg) > (CONFIG_FILE_LEN - 10)) data/dns2tcp-0.5.2/server/options.c:182:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(config_file, optarg, CONFIG_FILE_LEN-1); data/dns2tcp-0.5.2/server/queue.c:452:19: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((len = read(client->sd_tcp, buffer, len)) < 1) data/dns2tcp-0.5.2/server/queue.c:536: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). strlen(((char *)req->data) + DNS_HDR_SIZE))) data/dns2tcp-0.5.2/server/requests.c:113: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). || (strlen(list->data) > ressource_len)) data/dns2tcp-0.5.2/server/requests.c:229: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(str) + sizeof(t_packet); data/dns2tcp-0.5.2/server/rr.c:105:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy(domain, req->domain, sizeof(domain)); data/dns2tcp-0.5.2/server/rr.c:113: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(where); data/dns2tcp-0.5.2/server/rr.c:122: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(where); data/dns2tcp-0.5.2/server/rr.c:143: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(where) + 1; /* len + byte 0 (label data) */ data/dns2tcp-0.5.2/server/rr.c:165: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(where); data/dns2tcp-0.5.2/server/rr.c:195:11: [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(JUMP_DNS_HDR(hdr)), MAX_DNS_LEN)); data/dns2tcp-0.5.2/server/rr.c:225: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). strlen(JUMP_DNS_HDR(hdr)), MAX_DNS_LEN)); data/dns2tcp-0.5.2/server/server.c:179:4: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). read(0, buffer, MINI_BUFF); ANALYSIS SUMMARY: Hits = 198 Lines analyzed = 8623 in approximately 0.28 seconds (30954 lines/second) Physical Source Lines of Code (SLOC) = 5305 Hits@level = [0] 56 [1] 56 [2] 111 [3] 15 [4] 16 [5] 0 Hits@level+ = [0+] 254 [1+] 198 [2+] 142 [3+] 31 [4+] 16 [5+] 0 Hits/KSLOC@level+ = [0+] 47.8794 [1+] 37.3233 [2+] 26.7672 [3+] 5.84354 [4+] 3.01602 [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.