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/tayga-0.9.2/dynamic.c Examining data/tayga-0.9.2/list.h Examining data/tayga-0.9.2/nat64.c Examining data/tayga-0.9.2/tayga.c Examining data/tayga-0.9.2/addrmap.c Examining data/tayga-0.9.2/tayga.h Examining data/tayga-0.9.2/conffile.c FINAL RESULTS: data/tayga-0.9.2/conffile.c:209:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(gcfg->tundev, args[0]); data/tayga-0.9.2/conffile.c:344:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(gcfg->data_dir, args[0]); data/tayga-0.9.2/tayga.c:49:3: [4] (format) vprintf: If format strings can be influenced by an attacker, they can be exploited (CWE-134). Use a constant for the format specification. vprintf(format, ap); data/tayga-0.9.2/tayga.c:101:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(ifr.ifr_name, gcfg->tundev); data/tayga-0.9.2/tayga.c:151:2: [4] (buffer) strcpy: Does not check for buffer overflows when copying to destination [MS-banned] (CWE-120). Consider using snprintf, strcpy_s, or strlcpy (warning: strncpy easily misused). strcpy(ifr.ifr_name, gcfg->tundev); data/tayga-0.9.2/tayga.c:308:5: [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, USAGE_TEXT, argv[0]); data/tayga-0.9.2/tayga.c:288:7: [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. c = getopt_long(argc, argv, "c:dnu:g:rp:", longopts, &longind); data/tayga-0.9.2/tayga.c:465: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. if (chroot(gcfg->data_dir) < 0) { data/tayga-0.9.2/conffile.c:68: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 oldaddr[INET_ADDRSTRLEN]; data/tayga-0.9.2/conffile.c:69: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 oldline[128] = ""; data/tayga-0.9.2/conffile.c:75:4: [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(oldline, " from line %d", s->conffile_lineno); data/tayga-0.9.2/conffile.c:92: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 oldaddr[INET6_ADDRSTRLEN]; data/tayga-0.9.2/conffile.c:93: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 oldline[128] = ""; data/tayga-0.9.2/conffile.c:99:4: [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(oldline, " from line %d", s->conffile_lineno); data/tayga-0.9.2/conffile.c:224:13: [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). prefix4 = atoi(slash+1); data/tayga-0.9.2/conffile.c:239:13: [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). prefix6 = atoi(slash+1); data/tayga-0.9.2/conffile.c:382: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 line[512]; data/tayga-0.9.2/conffile.c:383: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 addrbuf[128]; data/tayga-0.9.2/conffile.c:386: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 *args[MAX_ARGS]; data/tayga-0.9.2/conffile.c:411:7: [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). in = fopen(conffile, "r"); data/tayga-0.9.2/dynamic.c:97: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 addrbuf4[INET_ADDRSTRLEN]; data/tayga-0.9.2/dynamic.c:98: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 addrbuf6[INET6_ADDRSTRLEN]; data/tayga-0.9.2/dynamic.c:182: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 addrbuf4[INET_ADDRSTRLEN]; data/tayga-0.9.2/dynamic.c:183: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 addrbuf6[INET6_ADDRSTRLEN]; data/tayga-0.9.2/dynamic.c:238: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 line[512]; data/tayga-0.9.2/dynamic.c:247:7: [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). in = fopen(MAP_FILE, "r"); data/tayga-0.9.2/dynamic.c:321: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 addrbuf4[INET_ADDRSTRLEN]; data/tayga-0.9.2/dynamic.c:322: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 addrbuf6[INET6_ADDRSTRLEN]; data/tayga-0.9.2/dynamic.c:324:8: [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). out = fopen(TMP_MAP_FILE, "w"); data/tayga-0.9.2/tayga.c:92: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). gcfg->tun_fd = open("/dev/net/tun", O_RDWR); data/tayga-0.9.2/tayga.c:261: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 addrbuf[INET6_ADDRSTRLEN]; data/tayga-0.9.2/tayga.c:425: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). pidfd = open(pidfile, O_WRONLY | O_CREAT | O_TRUNC, 0666); data/tayga-0.9.2/tayga.c:452:22: [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). gcfg->urandom_fd = open("/dev/urandom", O_RDONLY); data/tayga-0.9.2/tayga.h:195: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 tundev[IFNAMSIZ]; data/tayga-0.9.2/tayga.h:196: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 data_dir[512]; data/tayga-0.9.2/conffile.c:204: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(args[0]) + 1 > sizeof(gcfg->tundev)) { data/tayga-0.9.2/conffile.c:419: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(line) + 1 == sizeof(line)) { data/tayga-0.9.2/dynamic.c:256: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(line) + 1 == sizeof(line)) { data/tayga-0.9.2/tayga.c:75:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(gcfg->urandom_fd, d, len); data/tayga-0.9.2/tayga.c:197:8: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(gcfg->tun_fd, gcfg->recv_buf, gcfg->recv_buf_size); data/tayga-0.9.2/tayga.c:236:9: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). ret = read(signalfds[0], &sig, sizeof(sig)); data/tayga-0.9.2/tayga.c:442: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). if (write(pidfd, addrbuf, strlen(addrbuf)) != strlen(addrbuf)) { data/tayga-0.9.2/tayga.c:442:49: [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 (write(pidfd, addrbuf, strlen(addrbuf)) != strlen(addrbuf)) { ANALYSIS SUMMARY: Hits = 43 Lines analyzed = 3490 in approximately 0.10 seconds (33932 lines/second) Physical Source Lines of Code (SLOC) = 2916 Hits@level = [0] 9 [1] 8 [2] 27 [3] 2 [4] 6 [5] 0 Hits@level+ = [0+] 52 [1+] 43 [2+] 35 [3+] 8 [4+] 6 [5+] 0 Hits/KSLOC@level+ = [0+] 17.8326 [1+] 14.7462 [2+] 12.0027 [3+] 2.74348 [4+] 2.05761 [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.