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/miredo-1.2.6/include/gettext.h Examining data/miredo-1.2.6/compat/strlcpy.c Examining data/miredo-1.2.6/compat/test-closefrom.c Examining data/miredo-1.2.6/compat/fdatasync.c Examining data/miredo-1.2.6/compat/clock_nanosleep.c Examining data/miredo-1.2.6/compat/dummy.c Examining data/miredo-1.2.6/compat/test-strlcpy.c Examining data/miredo-1.2.6/compat/clock_gettime.c Examining data/miredo-1.2.6/compat/fixups.h Examining data/miredo-1.2.6/compat/closefrom.c Examining data/miredo-1.2.6/compat/clearenv.c Examining data/miredo-1.2.6/src/relayd.c Examining data/miredo-1.2.6/src/privproc.c Examining data/miredo-1.2.6/src/privproc.h Examining data/miredo-1.2.6/src/binreloc.c Examining data/miredo-1.2.6/src/conf.h Examining data/miredo-1.2.6/src/binreloc.h Examining data/miredo-1.2.6/src/miredo.h Examining data/miredo-1.2.6/src/miredo.c Examining data/miredo-1.2.6/src/checkconf.c Examining data/miredo-1.2.6/src/conf.c Examining data/miredo-1.2.6/src/serverd.c Examining data/miredo-1.2.6/src/main.c Examining data/miredo-1.2.6/libteredo/mire.c Examining data/miredo-1.2.6/libteredo/maintain.c Examining data/miredo-1.2.6/libteredo/relay.c Examining data/miredo-1.2.6/libteredo/init.c Examining data/miredo-1.2.6/libteredo/md5.h Examining data/miredo-1.2.6/libteredo/clock.h Examining data/miredo-1.2.6/libteredo/server.c Examining data/miredo-1.2.6/libteredo/maintain.h Examining data/miredo-1.2.6/libteredo/peerlist.c Examining data/miredo-1.2.6/libteredo/v4global.h Examining data/miredo-1.2.6/libteredo/server.h Examining data/miredo-1.2.6/libteredo/packets.h Examining data/miredo-1.2.6/libteredo/security.c Examining data/miredo-1.2.6/libteredo/clock.c Examining data/miredo-1.2.6/libteredo/teredo.h Examining data/miredo-1.2.6/libteredo/security.h Examining data/miredo-1.2.6/libteredo/checksum.h Examining data/miredo-1.2.6/libteredo/teredo.c Examining data/miredo-1.2.6/libteredo/stub.c Examining data/miredo-1.2.6/libteredo/peerlist.h Examining data/miredo-1.2.6/libteredo/md5.c Examining data/miredo-1.2.6/libteredo/test/addrcmp.c Examining data/miredo-1.2.6/libteredo/test/stresslist.c Examining data/miredo-1.2.6/libteredo/test/list.c Examining data/miredo-1.2.6/libteredo/test/md5test.c Examining data/miredo-1.2.6/libteredo/test/clock.c Examining data/miredo-1.2.6/libteredo/test/hmac.c Examining data/miredo-1.2.6/libteredo/test/teredo.c Examining data/miredo-1.2.6/libteredo/test/v4global.c Examining data/miredo-1.2.6/libteredo/debug.h Examining data/miredo-1.2.6/libteredo/packets.c Examining data/miredo-1.2.6/libteredo/v4global.c Examining data/miredo-1.2.6/libteredo/teredo-udp.h Examining data/miredo-1.2.6/libteredo/tunnel.h Examining data/miredo-1.2.6/libtun6/test_diag.c Examining data/miredo-1.2.6/libtun6/diag.c Examining data/miredo-1.2.6/libtun6/tun6.h Examining data/miredo-1.2.6/libtun6/tun6.c FINAL RESULTS: data/miredo-1.2.6/src/binreloc.c:82:10: [5] (race) readlink: This accepts filename arguments; if an attacker can move those files or change the link content, a race condition results. Also, it does not terminate with ASCII NUL. (CWE-362, CWE-20). Reconsider approach. size = readlink (path2, path, buf_size - 1); data/miredo-1.2.6/src/checkconf.c:51: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, fmt, ap); data/miredo-1.2.6/src/conf.c:88:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 2, 3))) data/miredo-1.2.6/src/conf.c:109:25: [4] (format) printf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. __attribute__ ((format (printf, 2, 3))) data/miredo-1.2.6/src/main.c:427:30: [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 ((servername == NULL) && access (conffile, R_OK)) data/miredo-1.2.6/src/main.c:440: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. || access (chrootdir, X_OK)) data/miredo-1.2.6/src/main.c:459:3: [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. snprintf (pidfile_buf, str_len, LOCALSTATEDIR"/run/%s.pid", data/miredo-1.2.6/src/miredo.c:227:2: [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_INFO, gettext (retval data/miredo-1.2.6/src/privproc.c:82:5: [4] (shell) execl: 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. execl (script_path, script_path, (char *)NULL); data/miredo-1.2.6/src/privproc.c:169:4: [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. snprintf (intbuf, sizeof (intbuf), "%"PRIu16, cfg.mtu); data/miredo-1.2.6/src/relayd.c:230:5: [4] (shell) execl: 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. execl (path, path, ifindex, (char *)NULL); data/miredo-1.2.6/libteredo/mire.c:253:14: [3] (buffer) getopt_long: 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 ((c = getopt_long (argc, argv, "hV", opts, NULL)) != -1) data/miredo-1.2.6/libteredo/test/stresslist.c:86:2: [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 ((unsigned int)seed); data/miredo-1.2.6/libteredo/test/stresslist.c:105:2: [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 ((unsigned int)seed); data/miredo-1.2.6/src/checkconf.c:190:14: [3] (buffer) getopt_long: 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 ((c = getopt_long (argc, argv, "c:fhp:t:u:V", opts, NULL)) != -1) data/miredo-1.2.6/src/checkconf.c:210:24: [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. const char *srcdir = getenv ("srcdir"); data/miredo-1.2.6/src/main.c:359:14: [3] (buffer) getopt_long: 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 ((c = getopt_long (argc, argv, "c:fhp:t:u:V", opts, NULL)) != -1) data/miredo-1.2.6/src/miredo.c:68:7: [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. && (chroot (miredo_chrootdir) || chdir ("/"))) data/miredo-1.2.6/compat/test-strlcpy.c:30: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[6]; data/miredo-1.2.6/include/gettext.h:210: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/miredo-1.2.6/include/gettext.h:212: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 buf[1024]; data/miredo-1.2.6/include/gettext.h:220: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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/miredo-1.2.6/include/gettext.h:222: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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/miredo-1.2.6/include/gettext.h:256: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 msg_ctxt_id[msgctxt_len + msgid_len]; data/miredo-1.2.6/include/gettext.h:258: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 buf[1024]; data/miredo-1.2.6/include/gettext.h:266: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 (msg_ctxt_id, msgctxt, msgctxt_len - 1); data/miredo-1.2.6/include/gettext.h:268: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 (msg_ctxt_id + msgctxt_len, msgid, msgid_len); data/miredo-1.2.6/libteredo/maintain.c:377: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(c_state, &newst, sizeof (*c_state)); data/miredo-1.2.6/libteredo/md5.c:184: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(xbuf, data, 64); data/miredo-1.2.6/libteredo/md5.c:358: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(pms->buf + offset, p, copy); data/miredo-1.2.6/libteredo/md5.c:372: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(pms->buf, p, left); data/miredo-1.2.6/libteredo/packets.c:85: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 (src.s6_addr, "\xfe\x80\x00\x00\x00\x00\x00\x00", 8); data/miredo-1.2.6/libteredo/packets.c:137: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 (auth + 4, nonce, 8); data/miredo-1.2.6/libteredo/packets.c:222:4: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (newaddr, &pi->nd_opt_pi_prefix, 8); data/miredo-1.2.6/libteredo/packets.c:428: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 (out + 1, in, inlen); data/miredo-1.2.6/libteredo/peerlist.c:104: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 (p->data, data, len); data/miredo-1.2.6/libteredo/relay.c:128: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 fill[1280 - sizeof (struct ip6_hdr) - sizeof (struct icmp6_hdr)]; data/miredo-1.2.6/libteredo/relay.c:199: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 b[INET_ADDRSTRLEN]; data/miredo-1.2.6/libteredo/relay.c:332: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 b[INET6_ADDRSTRLEN]; data/miredo-1.2.6/libteredo/relay.c:408: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 b[INET_ADDRSTRLEN]; data/miredo-1.2.6/libteredo/relay.c:560: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 b[INET6_ADDRSTRLEN]; data/miredo-1.2.6/libteredo/security.c:59:11: [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 key[LIBTEREDO_KEY_LEN]; data/miredo-1.2.6/libteredo/security.c:60:11: [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[HMAC_BLOCK_LEN]; data/miredo-1.2.6/libteredo/security.c:65:11: [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 key[LIBTEREDO_KEY_LEN]; data/miredo-1.2.6/libteredo/security.c:66:11: [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[HMAC_BLOCK_LEN]; data/miredo-1.2.6/libteredo/security.c:83:12: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open (randfile, O_RDONLY); data/miredo-1.2.6/libteredo/security.c:185: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 (hash, &hmac_pid, sizeof (hmac_pid)); data/miredo-1.2.6/libteredo/security.c:189: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 (hash, ((uint8_t *)×tamp) + 2, 2); data/miredo-1.2.6/libteredo/security.c:191: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 (hash, ×tamp, 2); data/miredo-1.2.6/libteredo/security.c:210: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 (((uint8_t *)×tamp) + 2, hash, 2); data/miredo-1.2.6/libteredo/security.c:212: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 (×tamp, hash, 2); data/miredo-1.2.6/libteredo/security.c:218:11: [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 h1[LIBTEREDO_HASH_LEN]; data/miredo-1.2.6/libteredo/security.c:247: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 (nonce, buf, LIBTEREDO_NONCE_LEN); data/miredo-1.2.6/libteredo/server.c:103: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 (auth + 4, nonce, 8); data/miredo-1.2.6/libteredo/server.c:141: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 (&addr->s6_addr[0], &s->prefix, sizeof (s->prefix)); data/miredo-1.2.6/libteredo/server.c:142: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 (&addr->s6_addr[4], &s->server_ip, sizeof (s->server_ip)); data/miredo-1.2.6/libteredo/server.c:265: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 v4s[INET_ADDRSTRLEN] = "unknown"; data/miredo-1.2.6/libteredo/server.c:266:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char v6s[INET6_ADDRSTRLEN] = "unknown"; data/miredo-1.2.6/libteredo/server.c:267: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 v6d[INET6_ADDRSTRLEN] = "unknown"; data/miredo-1.2.6/libteredo/server.c:552: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 str[INET_ADDRSTRLEN]; data/miredo-1.2.6/libteredo/server.c:562: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 str[INET_ADDRSTRLEN]; data/miredo-1.2.6/libteredo/teredo.c:177:2: [2] (buffer) char: Statically-sized arrays can be improperly restricted, leading to potential overflows or other issues (CWE-119!/CWE-120). Perform bounds checking, use functions that limit length, or ensure that the size is larger than the maximum possible length. char cbuf[CMSG_SPACE (sizeof (struct in_pktinfo))]; data/miredo-1.2.6/libteredo/teredo.c:179: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 cbuf[CMSG_SPACE (sizeof (struct in_addr))]; data/miredo-1.2.6/libteredo/teredo.c:265: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 (p->auth_nonce, ptr, 8); data/miredo-1.2.6/libteredo/teredo.c:289: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 (&port, ptr, 2); data/miredo-1.2.6/libteredo/teredo.c:294: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 (&addr, ptr, 4); data/miredo-1.2.6/libteredo/test/addrcmp.c:39: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 (&a1, "\x20\x01\x00\x00\xc0\x00\x02\x01" data/miredo-1.2.6/libteredo/test/hmac.c:49: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 (&src, "\x20\x01\x00\x00\x8a\xc3\x9d\xdd" data/miredo-1.2.6/libteredo/test/hmac.c:51:2: [2] (buffer) memcpy: Does not check for buffer overflows when copying to destination (CWE-120). Make sure destination can always hold the source data. memcpy (&dst, "\x20\x02\xc0\x00\x02\x42\x12\x42" data/miredo-1.2.6/libteredo/test/md5test.c:64: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. static const char *const test[7*2] = { data/miredo-1.2.6/libteredo/test/md5test.c:80: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 hex_output[16*2 + 1]; data/miredo-1.2.6/libteredo/test/stresslist.c:50: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 (addr->s6_addr + i, &v, sizeof (v)); data/miredo-1.2.6/libtun6/diag.c:70:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open (tundev, O_RDWR); data/miredo-1.2.6/libtun6/diag.c:141: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[256]; /* Hopefully big enough... :-/ */ data/miredo-1.2.6/libtun6/test_diag.c:38: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 errbuf[LIBTUN6_ERRBUF_SIZE]; data/miredo-1.2.6/libtun6/tun6.c:138: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 orig_name[IFNAMSIZ]; data/miredo-1.2.6/libtun6/tun6.c:184:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open (tundev, O_RDWR); data/miredo-1.2.6/libtun6/tun6.c:215:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open ("/dev/tun", O_RDWR); data/miredo-1.2.6/libtun6/tun6.c:225: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 tundev[5 + IFNAMSIZ]; data/miredo-1.2.6/libtun6/tun6.c:228:9: [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 (tundev, O_RDWR); data/miredo-1.2.6/libtun6/tun6.c:310: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 ifname[IFNAMSIZ]; data/miredo-1.2.6/libtun6/tun6.c:419:11: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). int fd = open (path, O_WRONLY); data/miredo-1.2.6/libtun6/tun6.c:685: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(&msg.gw, sdl, sdl->sdl_len); data/miredo-1.2.6/libtun6/tun6.c:728: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 ifname[IFNAMSIZ]; data/miredo-1.2.6/libtun6/tun6.c:733: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 proc_path[24 + IFNAMSIZ + 16 + 1] = "/proc/sys/net/ipv6/conf/"; data/miredo-1.2.6/src/binreloc.c:126:6: [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). f = fopen ("/proc/self/maps", "r"); data/miredo-1.2.6/src/binreloc.c:193: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 *address_string, line[SIZE], *found; data/miredo-1.2.6/src/binreloc.c:199:6: [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). f = fopen ("/proc/self/maps", "r"); data/miredo-1.2.6/src/binreloc.c:259: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 (address_string, "0x", 2); data/miredo-1.2.6/src/binreloc.c:260: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 (address_string + 2, start_addr, len); data/miredo-1.2.6/src/binreloc.c:264: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 (address_string, "0x", 2); data/miredo-1.2.6/src/binreloc.c:265: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 (address_string + 2, end_addr, len); data/miredo-1.2.6/src/binreloc.c:681: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 (result, str1, len1); data/miredo-1.2.6/src/binreloc.c:682: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 (result + len1, str2, len2); data/miredo-1.2.6/src/binreloc.c:727: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 (result, str, size); data/miredo-1.2.6/src/conf.c:235: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 lbuf[1056]; data/miredo-1.2.6/src/conf.c:254: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 nbuf[32], vbuf[1024]; data/miredo-1.2.6/src/conf.c:290:17: [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 *stream = fopen (path, "r"); data/miredo-1.2.6/src/conf.c:462: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 (value, &((const struct sockaddr_in6*)(res->ai_addr))->sin6_addr, data/miredo-1.2.6/src/main.c:160:7: [2] (misc) open: Check when opening files - can an attacker redirect it (via symlinks), force the opening of special file type (e.g., device files), move things around to create a race condition, control its ancestors, or change its contents? (CWE-362). fd = open (path, O_WRONLY|O_CREAT|O_NOFOLLOW, 0644); data/miredo-1.2.6/src/main.c:163: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 buf[20]; // enough for > 2^64 data/miredo-1.2.6/src/main.c:417: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 conffile_buf[str_len]; data/miredo-1.2.6/src/main.c:456: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 pidfile_buf[str_len]; data/miredo-1.2.6/src/privproc.c:111: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 intbuf[21]; data/miredo-1.2.6/src/privproc.c:157: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 addr[INET6_ADDRSTRLEN], lladdr[INET6_ADDRSTRLEN]; data/miredo-1.2.6/src/privproc.c:180: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 iface[IFNAMESIZE]; data/miredo-1.2.6/src/privproc.c:212: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 iface[IFNAMESIZE]; data/miredo-1.2.6/src/relayd.c:75: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 errbuf[LIBTUN6_ERRBUF_SIZE]; data/miredo-1.2.6/src/relayd.c:217: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 ifindex[2 * sizeof (unsigned) + 1]; data/miredo-1.2.6/src/relayd.c:286: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 str[INET6_ADDRSTRLEN]; data/miredo-1.2.6/src/relayd.c:456: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 namebuf[NI_MAXHOST], namebuf2[NI_MAXHOST]; data/miredo-1.2.6/src/serverd.c:57: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[1024]; data/miredo-1.2.6/include/gettext.h:206: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). size_t msgctxt_len = strlen (msgctxt) + 1; data/miredo-1.2.6/include/gettext.h:207: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). size_t msgid_len = strlen (msgid) + 1; data/miredo-1.2.6/include/gettext.h:252: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). size_t msgctxt_len = strlen (msgctxt) + 1; data/miredo-1.2.6/include/gettext.h:253: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). size_t msgid_len = strlen (msgid) + 1; data/miredo-1.2.6/libteredo/security.c:91:14: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). int val = read (fd, inner_key.key + len, LIBTEREDO_KEY_LEN - len); data/miredo-1.2.6/libteredo/test/md5test.c:84:50: [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). md5_append(&state, (const md5_byte_t *)test[i], strlen(test[i])); data/miredo-1.2.6/src/binreloc.c:77:2: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). Risk is low because the source is a constant string. strncpy (path2, "/proc/self/exe", buf_size - 1); data/miredo-1.2.6/src/binreloc.c:109:3: [1] (buffer) strncpy: Easily used incorrectly; doesn't always \0-terminate or check for invalid pointers [MS-banned] (CWE-120). strncpy (path, path2, buf_size - 1); data/miredo-1.2.6/src/binreloc.c:145: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). buf_size = strlen (line); data/miredo-1.2.6/src/binreloc.c:235: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 (file); data/miredo-1.2.6/src/binreloc.c:242: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 (file); data/miredo-1.2.6/src/binreloc.c:247: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 (start_addr); data/miredo-1.2.6/src/binreloc.c:248: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). if (len != strlen (end_addr)) data/miredo-1.2.6/src/binreloc.c:677: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). len1 = strlen (str1); data/miredo-1.2.6/src/binreloc.c:678: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). len2 = strlen (str2); data/miredo-1.2.6/src/binreloc.c:696:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (dir); data/miredo-1.2.6/src/binreloc.c:720:8: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). len = strlen (str); data/miredo-1.2.6/src/conf.c:240: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). size_t len = strlen (lbuf) - 1; data/miredo-1.2.6/src/conf.c:245:11: [1] (buffer) fgetc: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). while (fgetc (stream) != '\n') data/miredo-1.2.6/src/conf.c:256:11: [1] (buffer) sscanf: It's unclear if the %s limit in the format string is small enough (CWE-120). Check that the limit is sufficiently small, or use a different input function. switch (sscanf (lbuf, " %31s %1023s", nbuf, vbuf)) data/miredo-1.2.6/src/main.c:177: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). && (write (fd, buf, strlen (buf)) == (ssize_t)strlen (buf)) data/miredo-1.2.6/src/main.c:177:50: [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). && (write (fd, buf, strlen (buf)) == (ssize_t)strlen (buf)) data/miredo-1.2.6/src/main.c:211:8: [1] (access) umask: Ensure that umask is given most restrictive possible setting (e.g., 066 or 077) (CWE-732). (void)umask (022); data/miredo-1.2.6/src/main.c:413: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). str_len = strlen (path) + strlen (miredo_name) data/miredo-1.2.6/src/main.c:413:29: [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). str_len = strlen (path) + strlen (miredo_name) data/miredo-1.2.6/src/main.c:452:52: [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). str_len = sizeof (LOCALSTATEDIR"/run/" ".pid") + strlen (miredo_name); data/miredo-1.2.6/src/main.c:490:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if (read (pipes[0], &c, sizeof (c)) != sizeof (c)) ANALYSIS SUMMARY: Hits = 139 Lines analyzed = 13010 in approximately 0.36 seconds (35754 lines/second) Physical Source Lines of Code (SLOC) = 7823 Hits@level = [0] 123 [1] 27 [2] 94 [3] 7 [4] 10 [5] 1 Hits@level+ = [0+] 262 [1+] 139 [2+] 112 [3+] 18 [4+] 11 [5+] 1 Hits/KSLOC@level+ = [0+] 33.491 [1+] 17.7681 [2+] 14.3168 [3+] 2.30091 [4+] 1.40611 [5+] 0.127828 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.