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/6tunnel-0.13/6tunnel.c FINAL RESULTS: data/6tunnel-0.13/6tunnel.c:43:3: [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. printf(x); \ data/6tunnel-0.13/6tunnel.c:601:17: [3] (buffer) getopt: Some older implementations do not protect against internal buffer overflows (CWE-120, CWE-20). Check implementation on installation, or limit the size of all string inputs. while ((optc = getopt(argc, argv, "1dv46fHs:l:I:i:hu:m:L:A:p:")) != -1) { data/6tunnel-0.13/6tunnel.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 port_str[16]; data/6tunnel-0.13/6tunnel.c:210: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[4096], *outbuf = NULL, *inbuf = NULL; data/6tunnel-0.13/6tunnel.c:409: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(outbuf + outlen, buf + sent, ret - sent); data/6tunnel-0.13/6tunnel.c:430: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(inbuf + inlen, buf + sent, ret - sent); data/6tunnel-0.13/6tunnel.c:506: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]; data/6tunnel-0.13/6tunnel.c:511: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(source_map_file, "r"); data/6tunnel-0.13/6tunnel.c:646:18: [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). conn_limit = atoi(optarg); data/6tunnel-0.13/6tunnel.c:685:15: [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). local_port = atoi(argv[optind++]); data/6tunnel-0.13/6tunnel.c:687:48: [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). remote_port = (argc == optind) ? local_port : atoi(argv[optind]); data/6tunnel-0.13/6tunnel.c:820:13: [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 *f = fopen(pid_file, "w"); data/6tunnel-0.13/6tunnel.c:235:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((ret = read(rsock, buf + i, 1)) < 1) data/6tunnel-0.13/6tunnel.c:252:26: [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(rsock, tmp, strlen(tmp)) != strlen(tmp)) { data/6tunnel-0.13/6tunnel.c:252:42: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (write(rsock, tmp, strlen(tmp)) != strlen(tmp)) { data/6tunnel-0.13/6tunnel.c:264:26: [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(rsock, tmp, strlen(tmp)) != strlen(tmp)) { data/6tunnel-0.13/6tunnel.c:264:42: [1] (buffer) strlen: Does not handle strings that are not \0-terminated; if given one it may perform an over-read (it could cause a crash if unprotected) (CWE-126). if (write(rsock, tmp, strlen(tmp)) != strlen(tmp)) { data/6tunnel-0.13/6tunnel.c:341: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). if (write(sock, buf, strlen(buf)) != strlen(buf)) data/6tunnel-0.13/6tunnel.c:341:40: [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(sock, buf, strlen(buf)) != strlen(buf)) data/6tunnel-0.13/6tunnel.c:394:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((ret = read(sock, buf, sizeof(buf))) < 1) data/6tunnel-0.13/6tunnel.c:415:15: [1] (buffer) read: Check buffer boundaries if used in a loop including recursive loops (CWE-120, CWE-20). if ((ret = read(rsock, buf, sizeof(buf))) < 1) data/6tunnel-0.13/6tunnel.c:479:18: [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). for (x = 0; x < strlen(argv); x++) ANALYSIS SUMMARY: Hits = 22 Lines analyzed = 925 in approximately 0.03 seconds (32359 lines/second) Physical Source Lines of Code (SLOC) = 687 Hits@level = [0] 20 [1] 10 [2] 10 [3] 1 [4] 1 [5] 0 Hits@level+ = [0+] 42 [1+] 22 [2+] 12 [3+] 2 [4+] 1 [5+] 0 Hits/KSLOC@level+ = [0+] 61.1354 [1+] 32.0233 [2+] 17.4672 [3+] 2.91121 [4+] 1.4556 [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.